Skip to content

UnusedAssertionDetector reports false positive when assertion is contained in a local function #106

Description

@erawhctim

This works as expected:

@Test 
fun test() {
  val result = "some-string"

  assertThat(result).isEqualTo("some-string")
}

This fails with a false positive:

@Test 
fun test() {
  fun Assert<String>.assertResult() {
   this.isEqualTo("some-string")
  }

  assertThat("").apply { assertResult() }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions