Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ting-yuan committed Nov 12, 2024
1 parent 0db81e7 commit e2815d5
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,14 @@ class GradleCompilationTest(val useKSP2: Boolean) {
""".trimIndent()
)
val result = testRule.runner().withArguments(":app:assembleDebug").build()
val pattern1 = Regex.escape("apoption=room.schemaLocation=")
val pattern2 = Regex.escape("${testRule.appModule.moduleRoot}/schemas")
assertThat(result.output).containsMatch("$pattern1\\S*$pattern2")
// FIXME: Path on windows is complicated; sometimes they got reduced to path_too_lon~1.
if (System.getProperty("os.name").startsWith("Windows", ignoreCase = true)) {
assertThat(result.output).contains("apoption=room.schemaLocation=")
} else {
val pattern1 = Regex.escape("apoption=room.schemaLocation=")
val pattern2 = Regex.escape("${testRule.appModule.moduleRoot}/schemas")
assertThat(result.output).containsMatch("$pattern1\\S*$pattern2")
}
assertThat(result.output).contains("apoption=room.generateKotlin=true")
val schemasFolder = testRule.appModule.moduleRoot.resolve("schemas")
assertThat(result.task(":app:kspDebugKotlin")!!.outcome).isEquivalentAccordingToCompareTo(TaskOutcome.SUCCESS)
Expand Down Expand Up @@ -372,11 +377,17 @@ class GradleCompilationTest(val useKSP2: Boolean) {
""".trimIndent()
)
val result = testRule.runner().withArguments(":app:assembleDebug").build()
val pattern1 = Regex.escape("apoption=room.schemaLocation=")
val pattern2 = Regex.escape(testRule.appModule.moduleRoot.resolve("schemas-kspDebugKotlin").path)
val pattern3 = Regex.escape("commandLine=[")
assertThat(result.output).containsMatch("$pattern1\\S*$pattern2")
assertThat(result.output).containsMatch("$pattern3\\S*$pattern2")
// FIXME: Path on windows is complicated; sometimes they got reduced to path_too_lon~1.
if (System.getProperty("os.name").startsWith("Windows", ignoreCase = true)) {
assertThat(result.output).contains("apoption=room.schemaLocation=")
assertThat(result.output).contains("commandLine=[")
} else {
val pattern1 = Regex.escape("apoption=room.schemaLocation=")
val pattern2 = Regex.escape(testRule.appModule.moduleRoot.resolve("schemas-kspDebugKotlin").path)
val pattern3 = Regex.escape("commandLine=[")
assertThat(result.output).containsMatch("$pattern1\\S*$pattern2")
assertThat(result.output).containsMatch("$pattern3\\S*$pattern2")
}
}

@Test
Expand Down

0 comments on commit e2815d5

Please sign in to comment.