Index: test/cctest/interpreter/test-interpreter.cc |
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc |
index 188b3e61d99c5f8aef53684ba6eeff20819e06ac..d48ebadb6c1292d280d670e8c79d970d493f48f5 100644 |
--- a/test/cctest/interpreter/test-interpreter.cc |
+++ b/test/cctest/interpreter/test-interpreter.cc |
@@ -1637,3 +1637,41 @@ TEST(InterpreterFunctionLiteral) { |
Handle<Smi>(Smi::FromInt(3), handles.main_isolate())).ToHandleChecked(); |
CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(5)); |
} |
+ |
+ |
+TEST(InterpreterConstruct) { |
+ HandleAndZoneScope handles; |
+ |
+ std::string source( |
+ "function counter() { this.count = 0; }\n" |
+ "function " + |
+ InterpreterTester::function_name() + |
+ "() {\n" |
+ " var c = new counter();\n" |
+ " return c.count;\n" |
+ "}"); |
+ InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ auto callable = tester.GetCallable<>(); |
+ |
+ Handle<Object> return_val = callable().ToHandleChecked(); |
+ CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(0)); |
+} |
+ |
+ |
+TEST(InterpreterConstructWithArguments) { |
+ HandleAndZoneScope handles; |
+ |
+ std::string source( |
+ "function counter(x, y) { this.count = 0; this.x = 1; this.y = 2000; }\n" |
+ "function " + |
+ InterpreterTester::function_name() + |
+ "() {\n" |
+ " var c = new counter();\n" |
rmcilroy
2015/10/13 14:07:30
You're not actually passing the arguments to count
oth
2015/10/14 08:40:09
Done.
|
+ " return c.y;\n" |
+ "}"); |
+ InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ auto callable = tester.GetCallable<>(); |
+ |
+ Handle<Object> return_val = callable().ToHandleChecked(); |
+ CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(2000)); |
+} |