]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/to-string-on-string-object.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / to-string-on-string-object.js
diff --git a/tests/stress/to-string-on-string-object.js b/tests/stress/to-string-on-string-object.js
new file mode 100644 (file)
index 0000000..e4435e5
--- /dev/null
@@ -0,0 +1,15 @@
+function foo(o) {
+    return String(o);
+}
+
+noInline(foo);
+
+for (var i = 0; i < 100000; ++i) {
+    var result = foo(new String("hello"));
+    if (typeof result != "string") {
+        describe(result);
+        throw "Error: result isn't a string";
+    }
+    if (result != "hello")
+        throw "Error: bad result: " + result;
+}