Index: test/cctest/interpreter/test-interpreter.cc |
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc |
index fa9f89128b8ea1b094c2f6417f5c05ab1cfc427f..188b3e61d99c5f8aef53684ba6eeff20819e06ac 100644 |
--- a/test/cctest/interpreter/test-interpreter.cc |
+++ b/test/cctest/interpreter/test-interpreter.cc |
@@ -1620,3 +1620,20 @@ TEST(InterpreterCallRuntime) { |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(55)); |
} |
+ |
+ |
+TEST(InterpreterFunctionLiteral) { |
+ HandleAndZoneScope handles; |
+ |
+ // Test calling a function literal. |
+ std::string source( |
+ "function " + InterpreterTester::function_name() + "(a) {\n" |
+ " return (function(x){ return x + 2; })(a);\n" |
+ "}"); |
+ InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ auto callable = tester.GetCallable<Handle<Object>>(); |
+ |
+ Handle<i::Object> return_val = callable( |
+ Handle<Smi>(Smi::FromInt(3), handles.main_isolate())).ToHandleChecked(); |
+ CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(5)); |
+} |