MCPcopy Index your code
hub / github.com/nodejs/node / RunTest

Function RunTest

deps/v8/test/debugger/debug/es6/generators-debug-scopes.js:10–46  ·  view source on GitHub ↗
(name, formals_and_body, args, handler, continuation)

Source from the content-addressed store, hash-verified

8var global_marker = 7;
9
10function RunTest(name, formals_and_body, args, handler, continuation) {
11 var handler_called = false;
12 var exception = null;
13
14 function listener(event, exec_state, event_data, data) {
15 try {
16 if (event == Debug.DebugEvent.Break) {
17 handler_called = true;
18 handler(exec_state);
19 }
20 } catch (e) {
21 exception = e;
22 }
23 }
24
25 function run(thunk) {
26 handler_called = false;
27 exception = null;
28
29 var res = thunk();
30 if (continuation)
31 continuation(res);
32
33 assertTrue(handler_called, "listener not called for " + name);
34 assertNull(exception, name + " / " + exception);
35 }
36
37 var fun = Function.apply(null, formals_and_body);
38 var gen = (function*(){}).constructor.apply(null, formals_and_body);
39
40 Debug.setListener(listener);
41
42 run(function () { return fun.apply(null, args) });
43 run(function () { return gen.apply(null, args).next().value });
44
45 Debug.setListener(null);
46}
47
48// Check that two scope are the same.
49function assertScopeMirrorEquals(scope1, scope2) {

Callers 1

Calls 4

setListenerMethod · 0.80
runFunction · 0.70
nextMethod · 0.65
applyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…