X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/4be4e30906bcb8ee30b4d189205cb70bad6707ce..81345200c95645a1b0d2635520f96ad55dfde63f:/tests/stress/string-ident-to-not-string-var-equality.js diff --git a/tests/stress/string-ident-to-not-string-var-equality.js b/tests/stress/string-ident-to-not-string-var-equality.js new file mode 100644 index 0000000..3ceb1b2 --- /dev/null +++ b/tests/stress/string-ident-to-not-string-var-equality.js @@ -0,0 +1,32 @@ +function foo(a, b) { + return a === b; +} + +function bar(a, b) { + return b === a; +} + +function test(a, b, expected) { + var fooActual = foo(a, b); + var barActual = bar(a, b); + + if (fooActual != expected) + throw new Error("Bad result: " + fooActual); + if (barActual != expected) + throw new Error("Bad result: " + barActual); +} + +for (var i = 0; i < 10000; ++i) { + test("foo", "foo", true); + test("foo", "bar", false); + test("fuz", 42, false); + test("buz", {}, false); + test("bla", null, false); +} + +var fooString = ""; +fooString += "f"; +for (var i = 0; i < 2; ++i) + fooString += "o"; + +test(fooString, "foo", true);