summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/auto-regress/bug730806.js
blob: 9c5ed54b7e3707888dd36d09e7baadb8f40e5b87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Binary: cache/js-opt-32-2dc40eb83023-linux
// Flags: -m -n -a
//
function toPrinted(value) {
  return value = value.replace(/\\n/g, 'NL')
                      .replace(/\\r/g, 'CR')
                      .replace(/[^\x20-\x7E]+/g, escapeString);
}
function escapeString (str)
{
  var a, b, c, d;
  var len = str.length;
  var result = "";
  var digits = ["0", "1", "2", "3", "4", "5", "6", "7",
                "8", "9", "A", "B", "C", "D", "E", "F"];
  for (var i=0; i<len; i++)
  {
    var ch = str.charCodeAt(i);
    a = digits[ch & 0xf];
    if (ch)
    {
      c = digits[ch & 0xf];
      ch >>= 4;
      d = digits[ch & 0xf];
      result += "\\u" + d + c + b + a;
    }
  }
}
function reportCompare (expected, actual, description) {
function test() {
    try
    {
    }
    catch(e)
    {
    }
  }
}
try {
gczeal(2,4);
function setprop() {
}
} catch(exc1) {}
var trimMethods = ['trim', 'trimLeft', 'trimRight'];
var whitespace = [
  {s : '\u2028', t : 'LINE SEPARATOR'},
  ];
for (var j = 0; j < trimMethods.length; ++j)
{
  var method = trimMethods[j];
  for (var i = 0; i < whitespace.length; ++i)
  {
    var v = whitespace[i].s;
    var t = whitespace[i].t;
    v = v + v + v;
    str      = v;
    expected = '';
    actual   = str[method]();
    reportCompare(expected, actual, t + ':' + '"' + toPrinted(str) + '".' + method + '()');
  }
}