summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/emulates-undefined.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/basic/emulates-undefined.js')
-rw-r--r--js/src/jit-test/tests/basic/emulates-undefined.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/emulates-undefined.js b/js/src/jit-test/tests/basic/emulates-undefined.js
new file mode 100644
index 000000000..616a37b19
--- /dev/null
+++ b/js/src/jit-test/tests/basic/emulates-undefined.js
@@ -0,0 +1,18 @@
+function test() {
+ var values = [undefined, null, Math, objectEmulatingUndefined()];
+ var expected = [true, true, false, true];
+
+ for (var i=0; i<100; i++) {
+ var idx = i % values.length;
+ if (values[idx] == undefined)
+ assertEq(expected[idx], true);
+ else
+ assertEq(expected[idx], false);
+
+ if (null != values[idx])
+ assertEq(expected[idx], false);
+ else
+ assertEq(expected[idx], true);
+ }
+}
+test();