|
1 var expected = ''; |
|
2 function TestCase(n, d, e, a) {} |
|
3 function reportFailure (msg) {} |
|
4 function toPrinted(value) { |
|
5 value = value.replace(/\\\n/g, 'NL') |
|
6 .replace(/[^\x20-\x7E]+/g, escapeString); |
|
7 } |
|
8 function escapeString (str) {} |
|
9 function reportCompare (expected, actual, description) { |
|
10 var expected_t = typeof expected; |
|
11 var actual_t = typeof actual; |
|
12 var output = ""; |
|
13 var testcase = new TestCase("unknown-test-name", description, expected, actual); |
|
14 reportFailure (description + " : " + output); |
|
15 } |
|
16 function enterFunc (funcName) |
|
17 callStack.push(funcName); |
|
18 try { |
|
19 reportCompare(expectCompile, actualCompile, |
|
20 summary + ': compile actual'); |
|
21 } catch(ex) { } |
|
22 var lfcode = new Array(); |
|
23 lfcode.push("gczeal(2);\ |
|
24 enterFunc ('test');\ |
|
25 "); |
|
26 lfcode.push("{}"); |
|
27 lfcode.push("noexist.js"); |
|
28 lfcode.push("var BUGNUMBER = 305064;\ |
|
29 var summary = 'Tests the trim, trimRight and trimLeft methods';\ |
|
30 var trimMethods = ['trim', 'trimLeft', 'trimRight'];\ |
|
31 var whitespace = [\ |
|
32 {s : '\\u0009', t : 'HORIZONTAL TAB'},\ |
|
33 {s : '\\u200A', t : 'HAIR SPACE'},\ |
|
34 ];\ |
|
35 for (var j = 0; j < trimMethods.length; ++j)\ |
|
36 var method = trimMethods[j];\ |
|
37 reportCompare(true, true, 'Test skipped. String.prototype.' + method + ' is not supported');\ |
|
38 str = '';\ |
|
39 for (var i = 0; i < whitespace.length; ++i) {\ |
|
40 var v = whitespace[i].s;\ |
|
41 var t = (summary)[i].t;\ |
|
42 v = v + v + v;\ |
|
43 print('Test ' + method + ' with with leading whitespace. : ' + t);\ |
|
44 actual = str[method]();\ |
|
45 reportCompare(expected, actual, t + ':' + '\"' + toPrinted(str) + '\".' + method + '()');\ |
|
46 str = v + 'a' + v;\ |
|
47 }\ |
|
48 "); |
|
49 while (true) { |
|
50 var file = lfcode.shift(); if (file == undefined) { break; } |
|
51 if (file == "evaluate") { |
|
52 } else { |
|
53 loadFile(file); |
|
54 } |
|
55 } |
|
56 function loadFile(lfVarx) { |
|
57 try { |
|
58 if (lfVarx.substr(-3) == ".js") { |
|
59 switch (lfRunTypeId) { |
|
60 } |
|
61 } else { |
|
62 eval(lfVarx); |
|
63 } |
|
64 } catch (lfVare) { } |
|
65 } |