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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/basic/bug728086.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,65 @@
     1.4 +var expected = '';
     1.5 +function TestCase(n, d, e, a) {}
     1.6 +function reportFailure (msg) {}
     1.7 +function toPrinted(value) {
     1.8 +  value = value.replace(/\\\n/g, 'NL')
     1.9 +               .replace(/[^\x20-\x7E]+/g, escapeString);
    1.10 +}
    1.11 +function escapeString (str)   {}
    1.12 +function reportCompare (expected, actual, description) {
    1.13 +  var expected_t = typeof expected;
    1.14 +  var actual_t = typeof actual;
    1.15 +  var output = "";
    1.16 +  var testcase = new TestCase("unknown-test-name", description, expected, actual);
    1.17 +      reportFailure (description + " : " + output);
    1.18 +}
    1.19 +function enterFunc (funcName)
    1.20 +  callStack.push(funcName);
    1.21 +  try  {
    1.22 +    reportCompare(expectCompile, actualCompile,
    1.23 +                  summary + ': compile actual');
    1.24 +  }  catch(ex)  {  }
    1.25 +var lfcode = new Array();
    1.26 +lfcode.push("gczeal(2);\
    1.27 +enterFunc ('test');\
    1.28 +");
    1.29 +lfcode.push("{}");
    1.30 +lfcode.push("noexist.js");
    1.31 +lfcode.push("var BUGNUMBER = 305064;\
    1.32 +var summary = 'Tests the trim, trimRight  and trimLeft methods';\
    1.33 +var trimMethods = ['trim', 'trimLeft', 'trimRight'];\
    1.34 +var whitespace = [\
    1.35 +  {s : '\\u0009', t : 'HORIZONTAL TAB'},\
    1.36 +  {s : '\\u200A', t : 'HAIR SPACE'},\
    1.37 +  ];\
    1.38 +for (var j = 0; j < trimMethods.length; ++j)\
    1.39 +  var method = trimMethods[j];\
    1.40 +    reportCompare(true, true, 'Test skipped. String.prototype.' + method + ' is not supported');\
    1.41 +  str      = '';\
    1.42 +  for (var i = 0; i < whitespace.length; ++i) {\
    1.43 +    var v = whitespace[i].s;\
    1.44 +    var t = (summary)[i].t;\
    1.45 +    v = v + v + v;\
    1.46 +    print('Test ' + method + ' with with leading whitespace. : ' + t);\
    1.47 +    actual = str[method]();\
    1.48 +    reportCompare(expected, actual, t + ':' + '\"' + toPrinted(str) + '\".' + method + '()');\
    1.49 +    str = v + 'a' + v;\
    1.50 +}\
    1.51 +");
    1.52 +while (true) {
    1.53 +	var file = lfcode.shift(); if (file == undefined) { break; }
    1.54 +	if (file == "evaluate") {
    1.55 +	} else {
    1.56 +                loadFile(file);
    1.57 +	}
    1.58 +}
    1.59 +function loadFile(lfVarx) {
    1.60 +	try {
    1.61 +		if (lfVarx.substr(-3) == ".js") {
    1.62 +			switch (lfRunTypeId) {
    1.63 +			}
    1.64 +		} else {
    1.65 +			eval(lfVarx);
    1.66 +		}
    1.67 +	} catch (lfVare) {	}
    1.68 +}

mercurial