summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code/export-expname-binding-index.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/module-code/export-expname-binding-index.js
parentInitial commit. (diff)
downloadfirefox-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/test262/language/module-code/export-expname-binding-index.js')
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-binding-index.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/module-code/export-expname-binding-index.js b/js/src/tests/test262/language/module-code/export-expname-binding-index.js
new file mode 100644
index 0000000000..0b28b788e6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-binding-index.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// Copyright (C) 2021 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects
+description: >
+ Internal methods of module namespace exotic objects are correct
+ with non-Identifier bindings that are integer indices.
+info: |
+ [[HasProperty]] ( P )
+
+ [...]
+ 3. If P is an element of exports, return true.
+ 4. Return false.
+
+ [[Get]] ( P, Receiver )
+
+ [...]
+ 13. Return ? targetEnv.GetBindingValue(binding.[[BindingName]], true).
+
+ [[Set]] ( P, V, Receiver )
+
+ 1. Return false.
+
+ [[Delete]] ( P )
+
+ [...]
+ 4. If P is an element of exports, return false.
+ 5. Return true.
+flags: [module]
+features: [arbitrary-module-namespace-names, Reflect]
+---*/
+import * as ns from "./export-expname-binding-index_FIXTURE.js";
+
+assert.sameValue(ns[0], 0);
+assert.sameValue(Reflect.get(ns, 1), 1);
+assert.sameValue(ns[2], undefined);
+
+assert.throws(TypeError, () => { ns[0] = 1; });
+assert(!Reflect.set(ns, 1, 1));
+assert.throws(TypeError, () => { ns[2] = 2; });
+
+assert(0 in ns);
+assert(Reflect.has(ns, 1));
+assert(!(2 in ns));
+
+assert.throws(TypeError, () => { delete ns[0]; });
+assert(!Reflect.deleteProperty(ns, 1));
+assert(delete ns[2]);
+
+reportCompare(0, 0);