summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/dynamic-import/2nd-param-assert-value-abrupt.js
blob: 770cd15f29fc55c318a6a6f3c7d1fe9c2f998f3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
  Rejects promise when retrieving a value of the `assert` object produces an
  abrupt completion
esid: sec-import-call-runtime-semantics-evaluation
info: |
  2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
    [...]
    10. If options is not undefined, then
           [...]
        d. If assertionsObj is not undefined,
           [...]
           ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key).
           iii. IfAbruptRejectPromise(keys, promiseCapability).
           iv. Let supportedAssertions be ! HostGetSupportedImportAssertions().
           v. For each String key of keys,
              1. Let value be Get(assertionsObj, key).
              2. IfAbruptRejectPromise(value, promiseCapability).
    [...]
features: [dynamic-import, import-assertions]
flags: [async]
---*/

var thrown = new Test262Error();

import('./2nd-param_FIXTURE.js', {assert:{get ''() { throw thrown; }}})
  .then(function() {
    throw new Test262Error('Expected promise to be rejected, but it was fulfilled');
  }, function(error) {
    assert.sameValue(error, thrown);
  })
  .then($DONE, $DONE);