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

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

Issue 2703563002: [ESNext] Implement DynamicImportCall (Closed)
Patch Set: simplify error handling Created 3 years, 9 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
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 toString() {
11 throw new Error('42 is the answer');
12 }
13 };
14 import(x);
15
16 var x = {
17 get toString() {
18 throw new Error('42 is the answer');
19 }
20 };
21 import(x);
neis 2017/03/17 11:50:55 It's okay to use a different variable name :)
gsathya 2017/03/17 21:48:00 Acknowledged.
22
23 async function test() {
24 try {
25 let x = {
26 toString() {
27 throw new Error('42 is the answer');
28 }
29 };
30
31 let namespace = await import(x);
32 %AbortJS('failure: this should throw');
33 } catch(e) {
34 assertEquals(e.message, '42 is the answer');
35 ran = true;
36 }
37 }
38
39 test();
40
41 %RunMicrotasks();
42
43 assertTrue(ran);
44
45 ran = false;
46 async function test() {
47 try {
48 let x = {
49 get toString() {
50 throw new Error('42 is the answer');
51 }
52 };
53
54 let namespace = await import(x);
55 %AbortJS('failure: this should throw');
56 } catch(e) {
57 assertEquals(e.message, '42 is the answer');
58 ran = true;
59 }
60 }
61
62 test();
63
64 %RunMicrotasks();
65
66 assertTrue(ran);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698