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

Unified Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 1805503003: [Interpreter] Add bytecode generator expectations for super calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add additional test cases. Created 4 years, 9 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
Index: test/cctest/interpreter/test-bytecode-generator.cc
diff --git a/test/cctest/interpreter/test-bytecode-generator.cc b/test/cctest/interpreter/test-bytecode-generator.cc
index ff34d3164d6a60e7758ae52e2bc28e03e0f19289..717bf24ca41d9af0d27dded0e94388ca4be1a0f2 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -2100,8 +2100,6 @@ TEST(DoDebugger) {
CHECK_EQ(BuildActual(printer, snippets), LoadGolden("DoDebugger.golden"));
}
-// TODO(rmcilroy): Update expectations after switch to
-// Runtime::kDefineDataPropertyInLiteral.
TEST(ClassDeclarations) {
InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate(),
@@ -2133,7 +2131,64 @@ TEST(ClassDeclarations) {
LoadGolden("ClassDeclarations.golden"));
}
-// TODO(oth): Add tests for super keyword.
+TEST(ClassAndSuperClass) {
+ InitializedIgnitionHandleScope scope;
+ BytecodeExpectationsPrinter printer(CcTest::isolate(),
+ ConstantPoolType::kMixed);
+ printer.set_wrap(false);
+ printer.set_test_function_name("test");
+ const char* snippets[] = {
+ "var test;\n"
+ "(function() {\n"
+ " class A {\n"
+ " method() { return 2; }\n"
+ " }\n"
+ " class B extends A {\n"
+ " method() { return super.method() + 1; }\n"
+ " }\n"
+ " test = new B().method;\n"
+ " test();\n"
+ "})();\n",
+
+ "var test;\n"
+ "(function() {\n"
+ " class A {\n"
+ " get x() { return 1; }\n"
+ " set x(val) { return; }\n"
+ " }\n"
+ " class B extends A {\n"
+ " method() { super.x = 2; return super.x; }\n"
+ " }\n"
+ " test = new B().method;\n"
+ " test();\n"
+ "})();\n",
+
+ "var test;\n"
+ "(function() {\n"
+ " class A {\n"
+ " constructor(x) { this.x_ = x; }\n"
+ " }\n"
+ " class B extends A {\n"
+ " constructor() { super(1); this.y_ = 2; }\n"
+ " }\n"
+ " test = new B().constructor;\n"
+ "})();\n",
+
+ "var test;\n"
+ "(function() {\n"
+ " class A {\n"
+ " constructor() { this.x_ = 1; }\n"
+ " }\n"
+ " class B extends A {\n"
+ " constructor() { super(); this.y_ = 2; }\n"
+ " }\n"
+ " test = new B().constructor;\n"
+ "})();\n",
+ };
+
+ CHECK_EQ(BuildActual(printer, snippets),
+ LoadGolden("ClassAndSuperClass.golden"));
+}
} // namespace interpreter
} // namespace internal
« no previous file with comments | « test/cctest/interpreter/generate-bytecode-expectations.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698