js/src/jit-test/tests/basic/bug728086.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial