]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/compare-strict-eq-integer-to-misc.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / compare-strict-eq-integer-to-misc.js
diff --git a/tests/stress/compare-strict-eq-integer-to-misc.js b/tests/stress/compare-strict-eq-integer-to-misc.js
new file mode 100644 (file)
index 0000000..e4d7c9a
--- /dev/null
@@ -0,0 +1,25 @@
+function foo(thingy) {
+    if (thingy.length === void 0 || thingy.charAt !== void 0)
+        return "yes";
+    return "no";
+}
+
+noInline(foo);
+
+function test(object, expected) {
+    var result = foo(object);
+    if (result != expected)
+        throw new Error("Bad result: " + result);
+}
+
+for (var i = 0; i < 1000; ++i) {
+    test({}, "yes");
+    test([], "no");
+    test("hello", "yes");
+    test((function(){return arguments;})(), "no");
+    var array = [];
+    for (var j = 0; j < 100; ++j) {
+        test(array, "no");
+        array.push(42);
+    }
+}