Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: test/mjsunit/harmony/modules-import-8.js

Issue 2703563002: [ESNext] Implement DynamicImportCall (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/harmony/modules-import-7.js ('k') | test/mjsunit/harmony/modules-import-9.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
7 var ran = false;
8
9 var x = {
10 get toString() { return undefined; }
11 };
12 import(x);
13
14 var x = {
15 toString() {
16 throw new Error('42 is the answer');
17 }
18 };
19 import(x);
20
21 var x = {
22 get toString() {
23 throw new Error('42 is the answer');
24 }
25 };
26 import(x);
27
28 async function test1() {
29 try {
30 let x = {
31 toString() {
32 throw new Error('42 is the answer');
33 }
34 };
35
36 let namespace = await import(x);
37 %AbortJS('failure: this should throw');
38 } catch(e) {
39 assertEquals(e.message, '42 is the answer');
40 ran = true;
41 }
42 }
43
44 test1();
45
46 %RunMicrotasks();
47
48 assertTrue(ran);
49
50 ran = false;
51 async function test2() {
52 try {
53 let x = {
54 get toString() {
55 throw new Error('42 is the answer');
56 }
57 };
58
59 let namespace = await import(x);
60 %AbortJS('failure: this should throw');
61 } catch(e) {
62 assertEquals(e.message, '42 is the answer');
63 ran = true;
64 }
65 }
66
67 test2();
68
69 %RunMicrotasks();
70
71 assertTrue(ran);
72
73 ran = false;
74 async function test3() {
75 try {
76 let x = {
77 get toString() { return undefined; }
78 };
79 let namespace = await import(x);
80 %AbortJS('failure: this should throw');
81 } catch(e) {
82 assertEquals(e.message, 'Cannot convert object to primitive value');
83 ran = true;
84 }
85 }
86
87 test3();
88
89 %RunMicrotasks();
90
91 assertTrue(ran);
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/modules-import-7.js ('k') | test/mjsunit/harmony/modules-import-9.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698