mirror of
https://github.com/tc39/test262.git
synced 2025-07-22 05:24:38 +02:00
fix test in module/script modes
This commit is contained in:
parent
7f69f1c6bf
commit
292fd0c956
@ -11,8 +11,11 @@ info: |
|
|||||||
a. Let requiredModule be ? HostResolveImportedModule(module, required).
|
a. Let requiredModule be ? HostResolveImportedModule(module, required).
|
||||||
b. Perform ? requiredModule.ModuleEvaluation().
|
b. Perform ? requiredModule.ModuleEvaluation().
|
||||||
[...]
|
[...]
|
||||||
|
|
||||||
|
This test is meant to be flagged as module code, it should not initially
|
||||||
|
run as script code or the result will not be the same.
|
||||||
includes: [fnGlobalObject.js]
|
includes: [fnGlobalObject.js]
|
||||||
flags: [async]
|
flags: [async, module]
|
||||||
features: [dynamic-import]
|
features: [dynamic-import]
|
||||||
---*/
|
---*/
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: Script is evaluated exactly once after loaded by import
|
||||||
|
esid: sec-hostimportmoduledynamically
|
||||||
|
info: |
|
||||||
|
Success path
|
||||||
|
|
||||||
|
The completion value of any subsequent call to HostResolveImportedModule after
|
||||||
|
FinishDynamicImport has completed, given the arguments referencingScriptOrModule
|
||||||
|
and specifier, must be a module which has already been evaluated, i.e. whose
|
||||||
|
Evaluate concrete method has already been called and returned a normal completion.
|
||||||
|
|
||||||
|
This test is meant to __not__ be flagged as module code, it should not initially
|
||||||
|
run as module code or the result will not be the same.
|
||||||
|
includes: [fnGlobalObject.js]
|
||||||
|
flags: [async]
|
||||||
|
features: [dynamic-import]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var global = fnGlobalObject();
|
||||||
|
|
||||||
|
if (typeof global.evaluated === 'undefined') {
|
||||||
|
global.evaluated = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
global.evaluated++;
|
||||||
|
|
||||||
|
Promise.all([
|
||||||
|
import('./eval-self-once-script.js'),
|
||||||
|
import('./eval-self-once-script.js'),
|
||||||
|
]).then(async () => {
|
||||||
|
// Use await to serialize imports
|
||||||
|
await import('./eval-self-once-script.js');
|
||||||
|
await import('./eval-self-once-script.js');
|
||||||
|
|
||||||
|
assert.sameValue(global.evaluated, 2, 'global property was defined and incremented only once');
|
||||||
|
}).then($DONE, $DONE);
|
Loading…
x
Reference in New Issue
Block a user