(expected_final_state)
| 30 | } |
| 31 | |
| 32 | function TestCase(expected_final_state) { |
| 33 | var listener_exception = null; |
| 34 | var state_snapshot; |
| 35 | var listener_state; |
| 36 | var bp; |
| 37 | |
| 38 | function listener(event, exec_state, event_data, data) { |
| 39 | const location = exec_state.frames[0].location |
| 40 | print("Here (" + event + "/" + listener_state + "): " + |
| 41 | location.lineNumber + ":" + location.columnNumber); |
| 42 | try { |
| 43 | if (event == Debug.DebugEvent.Break) { |
| 44 | if (listener_state == 0) { |
| 45 | Debug.clearBreakPoint(bp); |
| 46 | Debug.stepOver(); |
| 47 | listener_state = 1; |
| 48 | } else if (listener_state == 1) { |
| 49 | state_snapshot = String(state); |
| 50 | print("State: " + state_snapshot); |
| 51 | Debug.setListener(null); |
| 52 | listener_state = 2; |
| 53 | } |
| 54 | } |
| 55 | } catch (e) { |
| 56 | listener_exception = e; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | |
| 61 | // Add the debug event listener. |
| 62 | listener_state = 0; |
| 63 | Debug.setListener(listener); |
| 64 | bp = Debug.setBreakPoint(f, 1); |
| 65 | |
| 66 | h(); |
| 67 | Debug.setListener(null); |
| 68 | if (listener_exception !== null) { |
| 69 | print("Exception caught: " + listener_exception); |
| 70 | assertUnreachable(); |
| 71 | } |
| 72 | |
| 73 | assertEquals(expected_final_state, state_snapshot); |
| 74 | } |
| 75 | |
| 76 | |
| 77 | // Warm-up -- make sure all is compiled and ready for breakpoint. |
no test coverage detected
searching dependent graphs…