X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/4be4e30906bcb8ee30b4d189205cb70bad6707ce..81345200c95645a1b0d2635520f96ad55dfde63f:/tests/stress/to-string-on-string-or-string-object.js?ds=inline diff --git a/tests/stress/to-string-on-string-or-string-object.js b/tests/stress/to-string-on-string-or-string-object.js new file mode 100644 index 0000000..5a5de96 --- /dev/null +++ b/tests/stress/to-string-on-string-or-string-object.js @@ -0,0 +1,23 @@ +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; + + result = foo("world"); + if (typeof result != "string") { + describe(result); + throw "Error: result isn't a string"; + } + if (result != "world") + throw "Error: bad result: " + result; +}