blob: 594e142f75639dd1217f072a6abfe5b059109f2c [file] [log] [blame]
fpizlo@apple.com0e6e1542013-03-18 18:09:22 +00001description(
2"Tests that we do ToString conversions correctly when String.prototype.valueOf is initially fine but then gets clobbered."
3);
4
5function foo(a) {
6 for (var i = 0; i < 100; ++i)
7 a = new String(a);
8 return a;
9}
10
11var expected = "\"hello\"";
12for (var i = 0; i < 150; ++i) {
13 if (i == 100) {
14 String.prototype.valueOf = function() { return 42; }
15 expected = "\"42\"";
16 }
17 shouldBe("\"\" + foo(\"hello\")", expected);
18}
19