summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testInitelemCond.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/jit-test/tests/basic/testInitelemCond.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/testInitelemCond.js b/js/src/jit-test/tests/basic/testInitelemCond.js
new file mode 100644
index 0000000000..2f83c12102
--- /dev/null
+++ b/js/src/jit-test/tests/basic/testInitelemCond.js
@@ -0,0 +1,13 @@
+
+/* Element initializers with unknown index. */
+
+function foo(i) {
+ var x = [1,2,i == 1 ? 3 : 4,5,6];
+ var y = "" + x;
+ if (i == 1)
+ assertEq(y, "1,2,3,5,6");
+ else
+ assertEq(y, "1,2,4,5,6");
+}
+for (var i = 0; i < 10; i++)
+ foo(i);