Skip to content

Commit

Permalink
Add test cases to RedundantSuspendModifier rule (#4430)
Browse files Browse the repository at this point in the history
This PR adds tests that run through previously uncovered paths of this rule.
  • Loading branch information
schalkms committed Dec 30, 2021
1 parent 885d602 commit bc06073
Showing 1 changed file with 24 additions and 0 deletions.
Expand Up @@ -63,6 +63,30 @@ object RedundantSuspendModifierSpec : Spek({
assertThat(subject.compileAndLintWithContext(env, code)).isEmpty()
}

it("does not report suspend function without body") {
val code = """
interface SuspendInterface {
suspend fun empty()
}
"""
assertThat(subject.compileAndLintWithContext(env, code)).isEmpty()
}

it("does not report overridden suspend function") {
val code = """
interface SuspendInterface {
suspend fun empty()
}
class SuspendClass : SuspendInterface {
override suspend fun empty() {
println("hello world")
}
}
"""
assertThat(subject.compileAndLintWithContext(env, code)).isEmpty()
}

it("ignores when iterator is suspending") {
val code = """
class SuspendingIterator {
Expand Down

0 comments on commit bc06073

Please sign in to comment.