Chromium Code Reviews| Index: test/inspector/runtime/function-inferred-names.js |
| diff --git a/test/inspector/runtime/function-inferred-names.js b/test/inspector/runtime/function-inferred-names.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fab2d84f2e6a074a8abda8f35224ec873c3056b3 |
| --- /dev/null |
| +++ b/test/inspector/runtime/function-inferred-names.js |
| @@ -0,0 +1,32 @@ |
| +// 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. |
| + |
| +print("Tests that creating instances from classes and functions will have the correct inferred name."); |
| + |
| +var functionKeywordInstance = "var f1 = function(){}; var o1 = new f1();"; |
| +var namespacedFunctionInstance = "var obj = {}; obj.functionClass = function(){}; var o2 = new obj.functionClass()"; |
| +var classKeywordInstance = "var f2 = class(){}; var o3 = new f2();"; |
| +var namespacedClassInstance = "obj.classClass = class(){}; var o4 = new obj.classClass()"; |
| + |
|
marja
2016/11/14 19:40:07
What's up with this duplication? What are these st
luoe
2016/11/14 19:51:37
My fault here, I thought I removed these duplicate
|
| +Protocol.Runtime.enable(); |
| + |
| +InspectorTest.runTestSuite([ |
| + function functionKeywordInstance(next) { |
| + Protocol.Runtime.evaluate({ expression: "var f1 = function(){}; new f1();" }).then(dumpResults).then(next); |
| + }, |
| + function namespacedFunctionInstance(next) { |
| + Protocol.Runtime.evaluate({ expression: "var obj = {}; obj.functionClass = function(){}; new obj.functionClass()" }).then(dumpResults).then(next); |
| + }, |
| + function classKeywordInstance(next) { |
| + Protocol.Runtime.evaluate({ expression: "var f2 = class{}; new f2();" }).then(dumpResults).then(next); |
| + }, |
| + function namespacedClassInstance(next) { |
| + Protocol.Runtime.evaluate({ expression: "var obj = {}; obj.classClass = class{}; new obj.classClass()" }).then(dumpResults).then(next); |
| + }, |
| + |
| +]); |
| + |
| +function dumpResults(response) { |
| + InspectorTest.log(response.result.result.className); |
| +} |