Skip to content

Commit fe987fe

Browse files
author
Jaroslav Tulach
committed
Applying on('return') hook to print information about name and location of the add function
1 parent c67b591 commit fe987fe

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

vm/tests/all/agentscript/EmbeddingSymlinks.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,13 @@ private static void enableInsight(Engine eng) throws IOException {
294294
+ " print(`loaded source named ${ev.name} from ${ev.uri}`);\n"
295295
+ "});\n"
296296
+ "\n"
297+
+ "insight.on('return', (ctx, frame) => {\n"
298+
+ " print(`computed add at ${ctx.source.name} from ${ctx.source.uri} with value ${ctx.returnValue(frame)}`);\n"
299+
+ "}, {\n"
300+
+ " roots: true,\n"
301+
+ " rootNameFilter: 'add',\n"
302+
+ "});\n"
303+
+ "\n"
297304
+ "", "insight.js").build();
298305

299306
register.apply(insightScript);

vm/tests/all/agentscript/agent-embedding-symlinks.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
>[0] java -ea -cp ${TMP_DIR} EmbeddingSymlinks ${TMP_DIR}
33
loaded source named foo from file:.*/baz.mjs
44
loaded source named fooMain.js from truffle:[0-9a-f]+/fooMain.js
5+
computed add at foo from file:.*/baz.mjs with value 42
56
foo add: 42
67
loaded source named bar from file:.*/baz.mjs
78
loaded source named barMain.js from truffle:[0-9a-f]+/barMain.js
9+
computed add at bar from file:.*/baz.mjs with value 42
810
bar add: 42

0 commit comments

Comments
 (0)