summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testNewString.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/basic/testNewString.js')
-rw-r--r--js/src/jit-test/tests/basic/testNewString.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/testNewString.js b/js/src/jit-test/tests/basic/testNewString.js
new file mode 100644
index 0000000000..e0f378bbc0
--- /dev/null
+++ b/js/src/jit-test/tests/basic/testNewString.js
@@ -0,0 +1,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);