File tree 2 files changed +13
-0
lines changed
main/kotlin/com/tschuchort/compiletesting
test/kotlin/com/tschuchort/compiletesting 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ abstract class SourceFile {
36
36
fun new (name : String , contents : String ) = object : SourceFile () {
37
37
override fun writeIfNeeded (dir : File ): File {
38
38
val file = dir.resolve(name)
39
+ file.parentFile.mkdirs()
39
40
file.createNewFile()
40
41
41
42
file.sink().buffer().use {
Original file line number Diff line number Diff line change @@ -91,6 +91,18 @@ class KotlinCompilationTests {
91
91
assertClassLoadable(result, " b.KSource" )
92
92
}
93
93
94
+ @Test
95
+ fun `runs with sources in directory` () {
96
+ val result = defaultCompilerConfig().apply {
97
+ sources = listOf (SourceFile .kotlin(" com/foo/bar/kSource.kt" , """
98
+ package com.foo.bar
99
+ class KSource""" ))
100
+ }.compile()
101
+
102
+ assertThat(result.exitCode).isEqualTo(ExitCode .OK )
103
+ assertClassLoadable(result, " com.foo.bar.KSource" )
104
+ }
105
+
94
106
@Test
95
107
fun `Kotlin can access JDK` () {
96
108
val source = SourceFile .kotlin(" kSource.kt" , """
You can’t perform that action at this time.
0 commit comments