summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/symbol/truthiness.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/symbol/truthiness.js')
-rw-r--r--js/src/jit-test/tests/symbol/truthiness.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/symbol/truthiness.js b/js/src/jit-test/tests/symbol/truthiness.js
new file mode 100644
index 000000000..a672158d6
--- /dev/null
+++ b/js/src/jit-test/tests/symbol/truthiness.js
@@ -0,0 +1,13 @@
+for (var i = 0; i < 9; i++)
+ assertEq(Symbol() ? 1 : 0, 1, "symbols are truthy");
+
+var a = [0, 0, 0, 0, 0, Symbol(), Symbol()];
+var b = [];
+function f(i, v) {
+ b[i] = v ? "yes" : "no";
+}
+for (var i = 0; i < a.length; i++)
+ f(i, a[i]);
+assertEq(b[b.length - 3], "no");
+assertEq(b[b.length - 2], "yes");
+assertEq(b[b.length - 1], "yes");