]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/to-string-on-object.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / to-string-on-object.js
CommitLineData
81345200
A
1function Foo() { }
2
3Foo.prototype.toString = function() { return "hello" };
4
5function foo(o) {
6 return String(o);
7}
8
9noInline(foo);
10
11for (var i = 0; i < 100000; ++i) {
12 var result = foo(new Foo());
13 if (typeof result != "string") {
14 describe(result);
15 throw "Error: result isn't a string";
16 }
17 if (result != "hello")
18 throw "Error: bad result: " + result;
19}