summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testNewString.js
blob: e0f378bbc06eadde368f41a09bddb289b9691ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function testNewString()
{
  var o = { toString: function() { return "string"; } };
  var r = [];
  for (var i = 0; i < 5; i++)
    r.push(typeof new String(o));
  for (var i = 0; i < 5; i++)
    r.push(typeof new String(3));
  for (var i = 0; i < 5; i++)
    r.push(typeof new String(2.5));
  for (var i = 0; i < 5; i++)
    r.push(typeof new String("string"));
  for (var i = 0; i < 5; i++)
    r.push(typeof new String(null));
  for (var i = 0; i < 5; i++)
    r.push(typeof new String(true));
  for (var i = 0; i < 5; i++)
    r.push(typeof new String(undefined));
  return r.length === 35 && r.every(function(v) { return v === "object"; });
}
assertEq(testNewString(), true);