Index: test/cctest/interpreter/test-interpreter.cc |
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc |
index a7370a86489dd655a12dbba23cc0fb2366c0d370..d9810983428df541b94718b6867a1b6e5ab8d242 100644 |
--- a/test/cctest/interpreter/test-interpreter.cc |
+++ b/test/cctest/interpreter/test-interpreter.cc |
@@ -2899,6 +2899,24 @@ TEST(InterpreterThisFunction) { |
CHECK(return_value->SameValue(*factory->NewStringFromStaticChars("f"))); |
} |
+ |
+TEST(InterpreterNewTarget) { |
+ HandleAndZoneScope handles; |
+ i::Isolate* isolate = handles.main_isolate(); |
+ i::Factory* factory = isolate->factory(); |
+ |
+ // TODO(rmcilroy): Add tests that we get the original constructor for |
+ // superclass constructors once we have class support. |
+ InterpreterTester tester(handles.main_isolate(), |
+ "function f() { this.a = new.target; }"); |
+ auto callable = tester.GetCallable<>(); |
+ callable().ToHandleChecked(); |
+ |
+ Handle<Object> new_target_name = v8::Utils::OpenHandle( |
+ *CompileRun("(function() { return (new f()).a.name; })();")); |
+ CHECK(new_target_name->SameValue(*factory->NewStringFromStaticChars("f"))); |
+} |
+ |
} // namespace interpreter |
} // namespace internal |
} // namespace v8 |