diff options
Diffstat (limited to 'js/src/jit-test/tests/basic/testFoldPropertyAccess.js')
-rw-r--r-- | js/src/jit-test/tests/basic/testFoldPropertyAccess.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/testFoldPropertyAccess.js b/js/src/jit-test/tests/basic/testFoldPropertyAccess.js new file mode 100644 index 000000000..2ccb5e21f --- /dev/null +++ b/js/src/jit-test/tests/basic/testFoldPropertyAccess.js @@ -0,0 +1,23 @@ + +var cases = [ + function (obj) { + return obj["ab"]; + }, + function (obj) { + return obj["a" + "b"]; + }, + function (obj) { + return obj[0 ? "cd" : "ab"]; + }, + function (obj) { + return obj[true ? "ab" : "cd"]; + }, + function (obj) { + return obj[(1 + 0) ? "ab" : "cd"]; + } +] + +for (var i = 0; i < cases.length; i++) { + assertEq(cases[i]({ab: 42}), 42); + assertEq(cases[i]({cd: 120}), undefined); +} |