Skip to content

Commit

Permalink
fixup! fixup! src: fix context inpection for V8 6.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Matheus Marchini committed Aug 20, 2018
1 parent 63ec96a commit d680b80
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/plugin/inspect-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const hashMapTests = {
const arrowSource = 'source:\n' +
'function c.hashmap.(anonymous function)(a,b)=>{a+b}\n' +
'>';

t.ok(lines.includes(arrowSource),
'hashmap[25] should have the correct function source');
cb(null);
Expand Down Expand Up @@ -305,14 +305,22 @@ const hashMapTests = {

const contextTests = {
'previous': {
re: /\(previous\)/,
re: /\(previous\)=(0x[0-9a-f]+)[^\n]+/,
desc: '.(previous)'
},
'closure': {
re: /\(closure\)=(0x[0-9a-f]+)[^\n]+function: closure/i,
re: /(\((?:closure|scope_info)\)=0x[0-9a-f]+)[^\n]+/i,
desc: '.(closure)',
validator(t, sess, addresses, name, cb) {
const address = addresses[name];
const type = addresses[name].split("=")[0];
let address = undefined;
if (type === "(closure)") {
address = addresses[name].split("=")[1];
} else if (type === "(scope_info)") {
address = addresses["previous"];
} else {
return cb(new Error("unknown field"));
}
sess.send(`v8 inspect ${address}`);
sess.linesUntil(/}>/, (err, lines) => {
if (err) return cb(err);
Expand Down

0 comments on commit d680b80

Please sign in to comment.