]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/other-is-object-or-null.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / other-is-object-or-null.js
diff --git a/tests/stress/other-is-object-or-null.js b/tests/stress/other-is-object-or-null.js
new file mode 100644 (file)
index 0000000..81c0b0a
--- /dev/null
@@ -0,0 +1,13 @@
+function foo(p) {
+    var x = p ? null : void 0;
+    return (typeof x) == "object";
+}
+
+noInline(foo);
+
+for (var i = 0; i < 10000; ++i) {
+    var p = !!(i & 1);
+    var result = foo(p);
+    if (result !== p)
+        throw "Error: bad result for p = " + p + ": " + result;
+}