OLD | NEW |
---|---|
(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); | |
OLD | NEW |