KT-64719 K2 KAPT stub generation should fail on syntax errors

This commit is contained in:
strangepleasures
2024-01-05 15:58:41 +00:00
committed by Space Team
parent bace053ea9
commit 894df8f641
4 changed files with 61 additions and 18 deletions
@@ -37,6 +37,7 @@ import java.util.zip.ZipOutputStream
import kotlin.io.path.appendText
import kotlin.io.path.deleteExisting
import kotlin.io.path.outputStream
import kotlin.io.path.writeText
import kotlin.test.assertEquals
abstract class Kapt3BaseIT : KGPBaseTest() {
@@ -1448,4 +1449,16 @@ open class Kapt3IT : Kapt3BaseIT() {
}
}
}
@DisplayName("KT-64719 KAPT stub generation should fail on files with syntax errors")
@GradleTest
fun testTopLevelSyntaxError(gradleVersion: GradleVersion) {
project("simple".withPrefix, gradleVersion) {
javaSourcesDir().resolve("invalid.kt").writeText("fun foo() { !!! }")
buildAndFail(":kaptGenerateStubsKotlin") {
assertOutputContains("invalid.kt:1:16 Expecting an element")
}
}
}
}