From 1f5666e0e823f88e377cea7e4ac9c372a1040a0f Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 30 May 2012 19:47:42 +0400 Subject: [PATCH] more tests in ScriptGenTest --- .../codegen/script/topLevelFunctionClosure.ktscript | 7 +++++++ .../tests/org/jetbrains/jet/codegen/ScriptGenTest.java | 4 ++++ 2 files changed, 11 insertions(+) create mode 100644 compiler/testData/codegen/script/topLevelFunctionClosure.ktscript diff --git a/compiler/testData/codegen/script/topLevelFunctionClosure.ktscript b/compiler/testData/codegen/script/topLevelFunctionClosure.ktscript new file mode 100644 index 00000000000..3a1b2a1f916 --- /dev/null +++ b/compiler/testData/codegen/script/topLevelFunctionClosure.ktscript @@ -0,0 +1,7 @@ +val x = 12 + +fun foo(y: Int) = x + y + +foo(33) + +// expected: 45 diff --git a/compiler/tests/org/jetbrains/jet/codegen/ScriptGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ScriptGenTest.java index b0422d7cdfa..b9e4a839868 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ScriptGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ScriptGenTest.java @@ -42,6 +42,10 @@ public class ScriptGenTest extends CodegenTestCase { // TODO: check function is visible as instance field (it is currently not) } + public void testTopLevelFunctionClosure() { + blackBoxFile("script/topLevelFunctionClosure.ktscript"); + } + public void testScriptParameter() { blackBoxFile("script/parameter.ktscript"); }