script: make top level declarations class members
This commit is contained in:
@@ -18,6 +18,8 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
@@ -37,9 +39,11 @@ public class ScriptGenTest extends CodegenTestCase {
|
||||
blackBoxFile("script/string.ktscript");
|
||||
}
|
||||
|
||||
public void testTopLevelFunction() {
|
||||
public void testTopLevelFunction() throws Exception {
|
||||
blackBoxFile("script/topLevelFunction.ktscript");
|
||||
// TODO: check function is visible as instance field (it is currently not)
|
||||
Method method = scriptInstance.getClass().getMethod("factorial", new Class<?>[]{ int.class });
|
||||
Object r = method.invoke(scriptInstance, 4);
|
||||
assertEquals(24, r);
|
||||
}
|
||||
|
||||
public void testTopLevelFunctionClosure() {
|
||||
@@ -58,6 +62,10 @@ public class ScriptGenTest extends CodegenTestCase {
|
||||
blackBoxFile("script/secondLevelVal.ktscript");
|
||||
}
|
||||
|
||||
public void testTopLevelProperty() {
|
||||
blackBoxFile("script/topLevelProperty.ktscript");
|
||||
}
|
||||
|
||||
public void testScriptParameter() {
|
||||
blackBoxFile("script/parameter.ktscript");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user