Simple test for non-kts script compilation

This commit is contained in:
Ilya Chernikov
2018-08-10 14:36:32 +02:00
parent 3f2552af60
commit 01dd665441
4 changed files with 21 additions and 4 deletions
@@ -0,0 +1,8 @@
// KOTLIN_SCRIPT_DEFINITION: org.jetbrains.kotlin.codegen.TestScriptWithNonKtsExtension
// param: world
val res = "Hello $name"
// expected: res=Hello world
@@ -138,3 +138,7 @@ object TestScriptWithSimpleEnvVarsConfiguration : ScriptCompilationConfiguration
@Suppress("unused") @Suppress("unused")
@KotlinScript(compilationConfiguration = TestScriptWithSimpleEnvVarsConfiguration::class) @KotlinScript(compilationConfiguration = TestScriptWithSimpleEnvVarsConfiguration::class)
abstract class TestScriptWithSimpleEnvVars abstract class TestScriptWithSimpleEnvVars
@Suppress("unused")
@KotlinScript(extension = "customext")
abstract class TestScriptWithNonKtsExtension(val name: String)
@@ -26,16 +26,21 @@ public class CustomScriptCodegenTestGenerated extends AbstractCustomScriptCodege
} }
public void testAllFilesPresentInCustomScript() throws Exception { public void testAllFilesPresentInCustomScript() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/customScript"), Pattern.compile("^(.+)\\.kts$"), TargetBackend.ANY, true); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/customScript"), Pattern.compile("^(.*)$"), TargetBackend.ANY, true);
} }
@TestMetadata("simpleEnvVars.kts") @TestMetadata("simpleEnvVars.kts")
public void testSimpleEnvVars() throws Exception { public void testSimpleEnvVars_kts() throws Exception {
runTest("compiler/testData/codegen/customScript/simpleEnvVars.kts"); runTest("compiler/testData/codegen/customScript/simpleEnvVars.kts");
} }
@TestMetadata("simple.customext")
public void testSimple_customext() throws Exception {
runTest("compiler/testData/codegen/customScript/simple.customext");
}
@TestMetadata("stringReceiver.kts") @TestMetadata("stringReceiver.kts")
public void testStringReceiver() throws Exception { public void testStringReceiver_kts() throws Exception {
runTest("compiler/testData/codegen/customScript/stringReceiver.kts"); runTest("compiler/testData/codegen/customScript/stringReceiver.kts");
} }
} }
@@ -169,7 +169,7 @@ fun main(args: Array<String>) {
} }
testClass<AbstractCustomScriptCodegenTest> { testClass<AbstractCustomScriptCodegenTest> {
model("codegen/customScript", extension = "kts") model("codegen/customScript", pattern = "^(.*)$")
} }
testClass<AbstractBytecodeTextTest> { testClass<AbstractBytecodeTextTest> {