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 --- .../language/module-code/instn-star-binding.js | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 js/src/tests/test262/language/module-code/instn-star-binding.js (limited to 'js/src/tests/test262/language/module-code/instn-star-binding.js') diff --git a/js/src/tests/test262/language/module-code/instn-star-binding.js b/js/src/tests/test262/language/module-code/instn-star-binding.js new file mode 100644 index 0000000000..16bcc86e9c --- /dev/null +++ b/js/src/tests/test262/language/module-code/instn-star-binding.js @@ -0,0 +1,34 @@ +// |reftest| module +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Immutable binding is created for module namespace object +esid: sec-moduledeclarationinstantiation +info: | + [...] + 12. For each ImportEntry Record in in module.[[ImportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + in.[[ModuleRequest]]). + b. If in.[[ImportName]] is "*", then + i. Let namespace be ? GetModuleNamespace(importedModule). + ii. Perform ! envRec.CreateImmutableBinding(in.[[LocalName]], true). + iii. Call envRec.InitializeBinding(in.[[LocalName]], namespace). + [...] +flags: [module] +---*/ + +assert.sameValue( + typeof ns, 'object', 'binding is initialized prior to module evaluation' +); + +var original = ns; + +assert.throws(TypeError, function() { + ns = null; +}, 'binding rejects assignment'); + +assert.sameValue(ns, original, 'binding value is immutable'); + +import * as ns from './instn-star-binding.js'; + +reportCompare(0, 0); -- cgit v1.2.3