js/src/jit-test/tests/auto-regress/bug730806.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/auto-regress/bug730806.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +// Binary: cache/js-opt-32-2dc40eb83023-linux
     1.5 +// Flags: -m -n -a
     1.6 +//
     1.7 +function toPrinted(value)
     1.8 +  value = value.replace(/\\n/g, 'NL')
     1.9 +               .replace(/\\r/g, 'CR')
    1.10 +               .replace(/[^\x20-\x7E]+/g, escapeString);
    1.11 +function escapeString (str)
    1.12 +{
    1.13 +  var a, b, c, d;
    1.14 +  var len = str.length;
    1.15 +  var result = "";
    1.16 +  var digits = ["0", "1", "2", "3", "4", "5", "6", "7",
    1.17 +                "8", "9", "A", "B", "C", "D", "E", "F"];
    1.18 +  for (var i=0; i<len; i++)
    1.19 +  {
    1.20 +    var ch = str.charCodeAt(i);
    1.21 +    a = digits[ch & 0xf];
    1.22 +    if (ch)
    1.23 +    {
    1.24 +      c = digits[ch & 0xf];
    1.25 +      ch >>= 4;
    1.26 +      d = digits[ch & 0xf];
    1.27 +      result += "\\u" + d + c + b + a;
    1.28 +    }
    1.29 +  }
    1.30 +}
    1.31 +function reportCompare (expected, actual, description) {
    1.32 +function test() {
    1.33 +    try
    1.34 +    {
    1.35 +    }
    1.36 +    catch(e)
    1.37 +    {
    1.38 +    }
    1.39 +  }
    1.40 +}
    1.41 +try {
    1.42 +gczeal(2,4);
    1.43 +function setprop() {
    1.44 +}
    1.45 +} catch(exc1) {}
    1.46 +var trimMethods = ['trim', 'trimLeft', 'trimRight'];
    1.47 +var whitespace = [
    1.48 +  {s : '\u2028', t : 'LINE SEPARATOR'},
    1.49 +  ];
    1.50 +for (var j = 0; j < trimMethods.length; ++j)
    1.51 +{
    1.52 +  var method = trimMethods[j];
    1.53 +  for (var i = 0; i < whitespace.length; ++i)
    1.54 +  {
    1.55 +    var v = whitespace[i].s;
    1.56 +    var t = whitespace[i].t;
    1.57 +    v = v + v + v;
    1.58 +    str      = v;
    1.59 +    expected = '';
    1.60 +    actual   = str[method]();
    1.61 +    reportCompare(expected, actual, t + ':' + '"' + toPrinted(str) + '".' + method + '()');
    1.62 +  }
    1.63 +}

mercurial