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

Unified Diff: test/cctest/test-func-name-inference.cc

Issue 1264603002: Add test for referring function name for classes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixt typo Created 5 years, 5 months 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 | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-func-name-inference.cc
diff --git a/test/cctest/test-func-name-inference.cc b/test/cctest/test-func-name-inference.cc
index e423c0f26203a347d5280a476674d9ff24c8f67b..d01a938590fddc4a6e50610bb49aaeac0628881c 100644
--- a/test/cctest/test-func-name-inference.cc
+++ b/test/cctest/test-func-name-inference.cc
@@ -87,6 +87,8 @@ static void CheckFunctionName(v8::Handle<v8::Script> script,
// Verify inferred function name.
SmartArrayPointer<char> inferred_name =
shared_func_info->inferred_name()->ToCString();
+ i::PrintF("expected: %s, found: %s\n", ref_inferred_name,
+ inferred_name.get());
CHECK_EQ(0, strcmp(ref_inferred_name, inferred_name.get()));
}
@@ -222,6 +224,44 @@ TEST(ObjectLiteral) {
}
+TEST(UpperCaseClass) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ v8::Handle<v8::Script> script = Compile(CcTest::isolate(),
+ "'use strict';\n"
+ "class MyClass {\n"
+ " constructor() {\n"
+ " this.value = 1;\n"
+ " }\n"
+ " method() {\n"
+ " this.value = 2;\n"
+ " }\n"
+ "}");
+ CheckFunctionName(script, "this.value = 1", "MyClass");
+ CheckFunctionName(script, "this.value = 2", "MyClass.method");
+}
+
+
+TEST(LowerCaseClass) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ v8::Handle<v8::Script> script = Compile(CcTest::isolate(),
+ "'use strict';\n"
+ "class myclass {\n"
+ " constructor() {\n"
+ " this.value = 1;\n"
+ " }\n"
+ " method() {\n"
+ " this.value = 2;\n"
+ " }\n"
+ "}");
+ CheckFunctionName(script, "this.value = 1", "myclass");
+ CheckFunctionName(script, "this.value = 2", "myclass.method");
+}
+
+
TEST(AsParameter) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
« no previous file with comments | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698