(name, func, args, handler, continuation)
| 9 | async function thrower() { throw 'Exception'; } |
| 10 | |
| 11 | async function test(name, func, args, handler, continuation) { |
| 12 | var handler_called = false; |
| 13 | var exception = null; |
| 14 | |
| 15 | function listener(event, exec_state, event_data, data) { |
| 16 | try { |
| 17 | if (event == Debug.DebugEvent.Break) { |
| 18 | handler_called = true; |
| 19 | handler(exec_state); |
| 20 | } |
| 21 | } catch (e) { |
| 22 | exception = e; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | Debug.setListener(listener); |
| 27 | |
| 28 | var result; |
| 29 | if (typeof func === "object") |
| 30 | result = await func.method.apply(func, args); |
| 31 | else |
| 32 | result = await func.apply(null, args); |
| 33 | |
| 34 | if (typeof continuation === "function") { |
| 35 | await continuation(result); |
| 36 | } |
| 37 | |
| 38 | assertTrue(handler_called, `Expected ${name} handler to be called`); |
| 39 | if (exception) { |
| 40 | exception.message = `${name} / ${exception.message}`; |
| 41 | print(exception.stack); |
| 42 | quit(1); |
| 43 | } |
| 44 | |
| 45 | Debug.setListener(null); |
| 46 | } |
| 47 | |
| 48 | async function runTests() { |
| 49 |
no test coverage detected
searching dependent graphs…