Skip to content

Commit

Permalink
fix exemptions
Browse files Browse the repository at this point in the history
  • Loading branch information
subhajitxyz committed Nov 11, 2024
1 parent 42fccfb commit 2bd406a
Showing 1 changed file with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,37 +84,6 @@ class TodoOpenCheckTest {
assertThat(outContent.toString().trim()).isEqualTo(TODO_CHECK_PASSED_OUTPUT_INDICATOR)
}

@Test
fun testTodoCheck_PrPresent_checkShouldFail() {
setUpGitHubService(
issueNumbers = listOf(11004, 11003, 11002, 11001),
pullRequestNumbers = listOf(11001)
)
val tempFile1 = tempFolder.newFile("testfiles/TempFile1.kt")
val tempFile2 = tempFolder.newFile("testfiles/TempFile2.kt")
val testContent1 =
"""
// TODO(#11002): test summary 1.
# TODO(#11004): test summary 2.
# TODO(#11001): test summary 3.
test Todo
test TODO
""".trimIndent()
val testContent2 =
"""
// TODO(#11001): test summary 3.
todo
<!-- TODO(#11003): test summary 4-->
""".trimIndent()
tempFile1.writeText(testContent1)
tempFile2.writeText(testContent2)

runScript()

assertThat(outContent.toString().trim()).isEqualTo(TODO_SYNTAX_CHECK_FAILED_OUTPUT_INDICATOR)
}

@Test
fun testTodoCheck_onlyPoorlyFormattedTodosPresent_checkShouldFail() {
setUpGitHubService(issueNumbers = emptyList())
Expand Down Expand Up @@ -808,6 +777,37 @@ class TodoOpenCheckTest {
assertThat(outContent.toString().trim()).isEqualTo(failureMessage)
}

@Test
fun testTodoCheck_PrPresent_checkShouldFail() {
setUpGitHubService(
issueNumbers = listOf(11004, 11003, 11002, 11001),
pullRequestNumbers = listOf(11001)
)
val tempFile1 = tempFolder.newFile("testfiles/TempFile1.kt")
val tempFile2 = tempFolder.newFile("testfiles/TempFile2.kt")
val testContent1 =
"""
// TODO(#11002): test summary 1.
# TODO(#11004): test summary 2.
# TODO(#11001): test summary 3.
test Todo
test TODO
""".trimIndent()
val testContent2 =
"""
// TODO(#11001): test summary 3.
todo
<!-- TODO(#11003): test summary 4-->
""".trimIndent()
tempFile1.writeText(testContent1)
tempFile2.writeText(testContent2)

runScript()

assertThat(outContent.toString().trim()).isEqualTo(TODO_SYNTAX_CHECK_FAILED_OUTPUT_INDICATOR)
}

private fun setUpGitHubService(
issueNumbers: List<Int>,
pullRequestNumbers: List<Int> = emptyList()
Expand Down

0 comments on commit 2bd406a

Please sign in to comment.