michael@0: var expected = ''; michael@0: function TestCase(n, d, e, a) {} michael@0: function reportFailure (msg) {} michael@0: function toPrinted(value) { michael@0: value = value.replace(/\\\n/g, 'NL') michael@0: .replace(/[^\x20-\x7E]+/g, escapeString); michael@0: } michael@0: function escapeString (str) {} michael@0: function reportCompare (expected, actual, description) { michael@0: var expected_t = typeof expected; michael@0: var actual_t = typeof actual; michael@0: var output = ""; michael@0: var testcase = new TestCase("unknown-test-name", description, expected, actual); michael@0: reportFailure (description + " : " + output); michael@0: } michael@0: function enterFunc (funcName) michael@0: callStack.push(funcName); michael@0: try { michael@0: reportCompare(expectCompile, actualCompile, michael@0: summary + ': compile actual'); michael@0: } catch(ex) { } michael@0: var lfcode = new Array(); michael@0: lfcode.push("gczeal(2);\ michael@0: enterFunc ('test');\ michael@0: "); michael@0: lfcode.push("{}"); michael@0: lfcode.push("noexist.js"); michael@0: lfcode.push("var BUGNUMBER = 305064;\ michael@0: var summary = 'Tests the trim, trimRight and trimLeft methods';\ michael@0: var trimMethods = ['trim', 'trimLeft', 'trimRight'];\ michael@0: var whitespace = [\ michael@0: {s : '\\u0009', t : 'HORIZONTAL TAB'},\ michael@0: {s : '\\u200A', t : 'HAIR SPACE'},\ michael@0: ];\ michael@0: for (var j = 0; j < trimMethods.length; ++j)\ michael@0: var method = trimMethods[j];\ michael@0: reportCompare(true, true, 'Test skipped. String.prototype.' + method + ' is not supported');\ michael@0: str = '';\ michael@0: for (var i = 0; i < whitespace.length; ++i) {\ michael@0: var v = whitespace[i].s;\ michael@0: var t = (summary)[i].t;\ michael@0: v = v + v + v;\ michael@0: print('Test ' + method + ' with with leading whitespace. : ' + t);\ michael@0: actual = str[method]();\ michael@0: reportCompare(expected, actual, t + ':' + '\"' + toPrinted(str) + '\".' + method + '()');\ michael@0: str = v + 'a' + v;\ michael@0: }\ michael@0: "); michael@0: while (true) { michael@0: var file = lfcode.shift(); if (file == undefined) { break; } michael@0: if (file == "evaluate") { michael@0: } else { michael@0: loadFile(file); michael@0: } michael@0: } michael@0: function loadFile(lfVarx) { michael@0: try { michael@0: if (lfVarx.substr(-3) == ".js") { michael@0: switch (lfRunTypeId) { michael@0: } michael@0: } else { michael@0: eval(lfVarx); michael@0: } michael@0: } catch (lfVare) { } michael@0: }