[inspector] rewritten test/inspector/let-const-with-api.js
- rewritten test using new harness, - removed command line API part since we check it separatelu in inspector/runtime/command-line-api.js R=jgruber@chromium.org Bug: none Change-Id: Ia12cab10a8e299bb17688c9c5f36e7f712aa70ee Reviewed-on: https://chromium-review.googlesource.com/595032 Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#47048}
This commit is contained in:
parent
f7d41ebe2c
commit
896afddedc
@ -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 <anonymous>: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] }
|
@ -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));
|
||||
}
|
41
test/inspector/console/scoped-variables-expected.txt
Normal file
41
test/inspector/console/scoped-variables-expected.txt
Normal file
@ -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 <anonymous>:1:1
|
||||
objectId : <objectId>
|
||||
subtype : error
|
||||
type : object
|
||||
}
|
||||
exceptionId : <exceptionId>
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
text : Uncaught
|
||||
}
|
||||
result : {
|
||||
className : SyntaxError
|
||||
description : SyntaxError: Identifier 'a' has already been declared at <anonymous>:1:1
|
||||
objectId : <objectId>
|
||||
subtype : error
|
||||
type : object
|
||||
}
|
||||
}
|
||||
Evaluating 'a'
|
||||
{
|
||||
description : 42
|
||||
type : number
|
||||
value : 42
|
||||
}
|
26
test/inspector/console/scoped-variables.js
Normal file
26
test/inspector/console/scoped-variables.js
Normal file
@ -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();
|
||||
})();
|
Loading…
Reference in New Issue
Block a user