diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/non262/strict/11.1.5.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/strict/11.1.5.js')
-rw-r--r-- | js/src/tests/non262/strict/11.1.5.js | 171 |
1 files changed, 171 insertions, 0 deletions
diff --git a/js/src/tests/non262/strict/11.1.5.js b/js/src/tests/non262/strict/11.1.5.js new file mode 100644 index 0000000000..7ba12fa98a --- /dev/null +++ b/js/src/tests/non262/strict/11.1.5.js @@ -0,0 +1,171 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ + +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +/* Simple identifier labels. */ +assertEq(testLenientAndStrict('({x:1, x:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({x:1, y:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({x:1, y:1, x:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +/* Property names can be written as strings, too. */ +assertEq(testLenientAndStrict('({x:1, "x":1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({"x":1, x:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({"x":1, "x":1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +/* Numeric property names. */ +assertEq(testLenientAndStrict('({1.5:1, 1.5:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({1.5:1, 15e-1:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({6.02214179e23:1, 6.02214179e23:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({6.02214179e23:1, 3.1415926535:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({ 1: 1, "1": 2 })', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({ "1": 1, 1: 2 })', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({ 2.5: 1, "2.5": 2 })', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({ "2.5": 1, 2.5: 2 })', + parsesSuccessfully, + parsesSuccessfully), + true); + +/* Many properties, to exercise JSAtomList's hash-table variant. */ +assertEq(testLenientAndStrict('({a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, j:1, k:1, l:1, m:1, n:1, o:1, p:1, q:1, r:1, s:1, t:1, u:1, v:1, w:1, x:1, y:1, z:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, j:1, k:1, l:1, m:1, n:1, o:1, p:1, q:1, r:1, s:1, t:1, u:1, v:1, w:1, x:1, y:1, a:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +/* + * Getters, setters, and value properties should conflict only when + * appropriate. + */ +assertEq(testLenientAndStrict('({get x() {}, x:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({x:1, get x() {}})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({set x(q) {}, x:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({x:1, set x(q) {}})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({1:1, set 1(q) {}})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({set 1(q) {}, 1:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({"1":1, set 1(q) {}})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({set 1(q) {}, "1":1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({get x() {}, set x(q) {}})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({set x(q) {}, get x() {}})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({get x() {}, set x(q) {}, x:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({set x(q) {}, get x() {}, x:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({get x() {}, get x() {}})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({set x(q) {}, set x(q) {}})', + parsesSuccessfully, + parsesSuccessfully), + true); + +assertEq(testLenientAndStrict('({get x() {}, set x(q) {}, y:1})', + parsesSuccessfully, + parsesSuccessfully), + true); + +reportCompare(true, true); |