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

Function test

deps/v8/test/debugger/debug/es8/async-function-debug-scopes.js:11–46  ·  view source on GitHub ↗
(name, func, args, handler, continuation)

Source from the content-addressed store, hash-verified

9async function thrower() { throw 'Exception'; }
10
11async 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
48async function runTests() {
49

Callers 1

runTestsFunction · 0.70

Calls 6

setListenerMethod · 0.80
continuationFunction · 0.50
assertTrueFunction · 0.50
printFunction · 0.50
quitFunction · 0.50
applyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…