Script refactoring, codegen tests: change test data according to semantics change

Add some new tests for uncovered cases
This commit is contained in:
Pavel V. Talanov
2015-11-17 15:14:15 +03:00
parent 6563830584
commit ad58617753
22 changed files with 42 additions and 26 deletions
@@ -31,6 +31,12 @@ import java.util.regex.Pattern;
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class ScriptCodegenTestGenerated extends AbstractScriptCodegenTest {
@TestMetadata("adder.kts")
public void testAdder() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/script/adder.kts");
doTest(fileName);
}
public void testAllFilesPresentInScript() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/script"), Pattern.compile("^(.+)\\.kts$"), true);
}
@@ -69,10 +69,8 @@ public class ScriptGenTest extends CodegenTestCase {
Method resultMethod = aClass.getDeclaredMethod("getResult");
assertTrue((resultMethod.getModifiers() & Opcodes.ACC_FINAL) != 0);
assertTrue((resultMethod.getModifiers() & Opcodes.ACC_PUBLIC) != 0);
Field rv = aClass.getField("rv");
assertTrue((result.getModifiers() & Opcodes.ACC_PRIVATE) != 0);
Object script = constructor.newInstance();
assertEquals(12, rv.get(script));
assertEquals(8, result.get(script));
assertEquals(8, resultMethod.invoke(script));
}
@@ -133,6 +133,12 @@ public class ReplInterpreterTestGenerated extends AbstractReplInterpreterTest {
doTest(fileName);
}
@TestMetadata("classReferencesVal.repl")
public void testClassReferencesVal() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/repl/classes/classReferencesVal.repl");
doTest(fileName);
}
@TestMetadata("emptyClass.repl")
public void testEmptyClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/repl/classes/emptyClass.repl");