From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- js/src/jit-test/tests/for-of/bug-728079-js17-1.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 js/src/jit-test/tests/for-of/bug-728079-js17-1.js (limited to 'js/src/jit-test/tests/for-of/bug-728079-js17-1.js') diff --git a/js/src/jit-test/tests/for-of/bug-728079-js17-1.js b/js/src/jit-test/tests/for-of/bug-728079-js17-1.js new file mode 100644 index 0000000000..1bc920dab9 --- /dev/null +++ b/js/src/jit-test/tests/for-of/bug-728079-js17-1.js @@ -0,0 +1,21 @@ +// for-of does not trigger the JS 1.7 for-in destructuring special case. + +var data = [[1, 2, 3], [4, 5, 6, 7]]; + +function test(vars, expr, result) { + var s = ''; + eval("for (" + vars + " of data) s += (" + expr + ") + ';';"); + assertEq(s, result); +} + +for (var prefix of ["var ", "let ", ""]) { + test(prefix + "[a, b, c]", + "a + ',' + b + ',' + c", + "1,2,3;4,5,6;"); +} + +test("var [a]", "a", "1;4;"); +test("var {length: len}", "len", "3;4;"); +test("var {length}", "length", "3;4;"); +test("{}", "0", "0;0;"); + -- cgit v1.2.3