From d680b8059a31f3ff54cc1d1ad490fdee605548c3 Mon Sep 17 00:00:00 2001 From: Matheus Marchini Date: Mon, 20 Aug 2018 14:21:06 -0300 Subject: [PATCH] fixup! fixup! src: fix context inpection for V8 6.8 --- test/plugin/inspect-test.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/plugin/inspect-test.js b/test/plugin/inspect-test.js index ed4da485..0d4dbcdb 100644 --- a/test/plugin/inspect-test.js +++ b/test/plugin/inspect-test.js @@ -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); @@ -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);