diff --git a/test/inspector/console/let-const-with-api-expected.txt b/test/inspector/console/let-const-with-api-expected.txt deleted file mode 100644 index 0ea6476c4a..0000000000 --- a/test/inspector/console/let-const-with-api-expected.txt +++ /dev/null @@ -1,20 +0,0 @@ -Tests how let and const interact with command line api -first "let a = 1;" result: wasThrown = false -second "let a = 1;" result: wasThrown = true -exception message: Uncaught SyntaxError: Identifier 'a' has already been declared - at :1:1 -{"result":{"type":"number","value":42,"description":"42"}} -function dir(value) { [Command Line API] } -function dirxml(value) { [Command Line API] } -function keys(object) { [Command Line API] } -function values(object) { [Command Line API] } -function profile(title) { [Command Line API] } -function profileEnd(title) { [Command Line API] } -function inspect(object) { [Command Line API] } -function copy(value) { [Command Line API] } -function clear() { [Command Line API] } -function debug(function) { [Command Line API] } -function undebug(function) { [Command Line API] } -function monitor(function) { [Command Line API] } -function unmonitor(function) { [Command Line API] } -function table(data, [columns]) { [Command Line API] } diff --git a/test/inspector/console/let-const-with-api.js b/test/inspector/console/let-const-with-api.js deleted file mode 100644 index b51572d08e..0000000000 --- a/test/inspector/console/let-const-with-api.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -let {session, contextGroup, Protocol} = InspectorTest.start('Tests how let and const interact with command line api'); - -Protocol.Runtime.evaluate({ expression: "let a = 42;" }).then(step2); - -function step2(response) -{ - failIfError(response); - InspectorTest.log("first \"let a = 1;\" result: wasThrown = " + !!response.result.exceptionDetails); - Protocol.Runtime.evaluate({ expression: "let a = 239;" }).then(step3); -} - -function step3(response) -{ - failIfError(response); - InspectorTest.log("second \"let a = 1;\" result: wasThrown = " + !!response.result.exceptionDetails); - if (response.result.exceptionDetails) - InspectorTest.log("exception message: " + response.result.exceptionDetails.text + " " + response.result.exceptionDetails.exception.description); - Protocol.Runtime.evaluate({ expression: "a" }).then(step4); -} - -function step4(response) -{ - failIfError(response); - InspectorTest.log(JSON.stringify(response.result)); - checkMethod(null); -} - -var methods = [ "dir", "dirxml", "keys", "values", "profile", "profileEnd", - "inspect", "copy", "clear", - "debug", "undebug", "monitor", "unmonitor", "table" ]; - -function checkMethod(response) -{ - failIfError(response); - - if (response) - InspectorTest.log(response.result.result.description); - - var method = methods.shift(); - if (!method) - InspectorTest.completeTest(); - - Protocol.Runtime.evaluate({ expression: method, includeCommandLineAPI: true }).then(checkMethod); -} - -function failIfError(response) -{ - if (response && response.error) - InspectorTest.log("FAIL: " + JSON.stringify(response.error)); -} diff --git a/test/inspector/console/scoped-variables-expected.txt b/test/inspector/console/scoped-variables-expected.txt new file mode 100644 index 0000000000..cbafd502ff --- /dev/null +++ b/test/inspector/console/scoped-variables-expected.txt @@ -0,0 +1,41 @@ +Tests scoped variable in Runtime.evaluate +Evaluating 'let a = 42;' +{ + type : undefined +} +Evaluating 'a' +{ + description : 42 + type : number + value : 42 +} +Evaluating 'let a = 239;' +{ + exceptionDetails : { + columnNumber : 0 + exception : { + className : SyntaxError + description : SyntaxError: Identifier 'a' has already been declared at :1:1 + objectId : + subtype : error + type : object + } + exceptionId : + lineNumber : 0 + scriptId : + text : Uncaught + } + result : { + className : SyntaxError + description : SyntaxError: Identifier 'a' has already been declared at :1:1 + objectId : + subtype : error + type : object + } +} +Evaluating 'a' +{ + description : 42 + type : number + value : 42 +} diff --git a/test/inspector/console/scoped-variables.js b/test/inspector/console/scoped-variables.js new file mode 100644 index 0000000000..19d4926be5 --- /dev/null +++ b/test/inspector/console/scoped-variables.js @@ -0,0 +1,26 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = + InspectorTest.start('Tests scoped variable in Runtime.evaluate'); + +(async function test() { + InspectorTest.log('Evaluating \'let a = 42;\''); + var {result:{result}} = await Protocol.Runtime.evaluate({ + expression:'let a = 42;'}); + InspectorTest.logMessage(result); + InspectorTest.log('Evaluating \'a\''); + var {result:{result}} = await Protocol.Runtime.evaluate({ + expression:'a'}); + InspectorTest.logMessage(result); + InspectorTest.log('Evaluating \'let a = 239;\''); + var {result} = await Protocol.Runtime.evaluate({ + expression:'let a = 239;'}); + InspectorTest.logMessage(result); + InspectorTest.log('Evaluating \'a\''); + var {result:{result}} = await Protocol.Runtime.evaluate({ + expression:'a'}); + InspectorTest.logMessage(result); + InspectorTest.completeTest(); +})();