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 | |
6 | |
7 async function test(func, funcs) { | 5 async function test(func, funcs) { |
8 try { | 6 try { |
9 await func(); | 7 await func(); |
10 throw new Error("Expected " + func.toString() + " to throw"); | 8 throw new Error("Expected " + func.toString() + " to throw"); |
11 } catch (e) { | 9 } catch (e) { |
12 var stack = e.stack.split('\n'). | 10 var stack = e.stack.split('\n'). |
13 slice(1). | 11 slice(1). |
14 map(line => line.trim()). | 12 map(line => line.trim()). |
15 map(line => line.match(/at (?:(.*) )?.*$/)[1]). | 13 map(line => line.match(/at (?:(.*) )?.*$/)[1]). |
16 filter(x => typeof x === 'string' && x.length); | 14 filter(x => typeof x === 'string' && x.length); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } catch (e) { | 167 } catch (e) { |
170 throw new Error("FAIL"); | 168 throw new Error("FAIL"); |
171 } | 169 } |
172 }, ["test"]); | 170 }, ["test"]); |
173 } | 171 } |
174 | 172 |
175 runTests().catch(e => { | 173 runTests().catch(e => { |
176 print(e); | 174 print(e); |
177 quit(1); | 175 quit(1); |
178 }); | 176 }); |
OLD | NEW |