Skip to content

Commit 0a46eb6

Browse files
committed
Test compiled class files are in outputDirectory
1 parent f124477 commit 0a46eb6

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/test/kotlin/com/tschuchort/compiletesting/KotlinCompilationTests.kt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,41 @@ class KotlinCompilationTests {
741741
assertThat(result.generatedFiles.map { it.name }).contains("JSource.class")
742742
}
743743

744+
@Test
745+
fun `Output directory contains compiled class files`() {
746+
val jSource = SourceFile.java(
747+
"JSource.java", """
748+
package com.tschuchort.compiletesting;
749+
750+
@ProcessElem
751+
class JSource {
752+
void foo() {
753+
}
754+
}
755+
"""
756+
)
744757

758+
val kSource = SourceFile.kotlin(
759+
"KSource.kt", """
760+
package com.tschuchort.compiletesting
761+
762+
@ProcessElem
763+
class KSource {
764+
fun foo() {}
765+
}
766+
"""
767+
)
768+
769+
val result = defaultCompilerConfig().apply {
770+
sources = listOf(jSource, kSource)
771+
annotationProcessors = emptyList()
772+
inheritClassPath = true
773+
}.compile()
774+
775+
assertThat(result.exitCode).isEqualTo(ExitCode.OK)
776+
assertThat(result.outputDirectory.listFilesRecursively().map { it.name })
777+
.contains("JSource.class", "KSource.class")
778+
}
745779

746780
private fun defaultCompilerConfig(): KotlinCompilation {
747781
return KotlinCompilation().apply {

0 commit comments

Comments
 (0)