1// Copyright 2017 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --allow-natives-syntax --harmony-dynamic-import
6
7var ran = false;
8
9async function test2() {
10  try {
11    let x = await import('modules-skip-9.mjs');
12    %AbortJS('failure: should be unreachable');
13  } catch(e) {
14    assertInstanceof(e, SyntaxError);
15    assertEquals(
16      "The requested module 'modules-skip-empty.mjs' does not provide an " +
17      "export named 'default'",
18      e.message);
19    ran = true;
20  }
21}
22
23test2();
24%PerformMicrotaskCheckpoint();
25assertTrue(ran);
26
27ran = false;
28
29async function test3() {
30  try {
31    let x = await import('nonexistent-file.mjs');
32    %AbortJS('failure: should be unreachable');
33  } catch(e) {
34    assertTrue(e.message.startsWith('d8: Error reading'));
35    ran = true;
36  }
37}
38
39test3();
40%PerformMicrotaskCheckpoint();
41assertTrue(ran);
42