OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-async-await | 5 // Flags: --harmony-async-await |
6 | 6 |
7 async function test(func, funcs) { | 7 async function test(func, funcs) { |
8 try { | 8 try { |
9 await func(); | 9 await func(); |
10 throw new Error("Expected " + func.toString() + " to throw"); | 10 throw new Error("Expected " + func.toString() + " to throw"); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 await test(async() => { await 1; throw new Error("FAIL") }, ["async"]); | 91 await test(async() => { await 1; throw new Error("FAIL") }, ["async"]); |
92 | 92 |
93 await test(async() => { | 93 await test(async() => { |
94 await 1; | 94 await 1; |
95 try { | 95 try { |
96 await thrower(); | 96 await thrower(); |
97 } catch (e) { | 97 } catch (e) { |
98 throw new Error("FAIL"); | 98 throw new Error("FAIL"); |
99 } | 99 } |
100 }, ["e"]); // TODO(caitp): FuncNameInferer is doing some weird stuff... | 100 }, ["async"]); |
101 | 101 |
102 await test(async() => { | 102 await test(async() => { |
103 await 1; | 103 await 1; |
104 try { | 104 try { |
105 await reject(); | 105 await reject(); |
106 } catch (e) { | 106 } catch (e) { |
107 throw new Error("FAIL"); | 107 throw new Error("FAIL"); |
108 } | 108 } |
109 }, ["e"]); | 109 }, ["async"]); |
110 } | 110 } |
111 | 111 |
112 runTests().catch(e => { | 112 runTests().catch(e => { |
113 print(e); | 113 print(e); |
114 quit(1); | 114 quit(1); |
115 }); | 115 }); |
OLD | NEW |