Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1245)

Unified Diff: test/inspector/runtime/function-inferred-names.js

Issue 2488193003: Generate inferred names for es6 class functions (Closed)
Patch Set: fix test expectation Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | test/inspector/runtime/function-inferred-names-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « src/parsing/parser.cc ('k') | test/inspector/runtime/function-inferred-names-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698