bnorm/kotlin-power-assert

Diagram is shown twice when using kotlin.check

Closed this issue · 3 comments

When doing tests in commonTest we don't have access to kotlin.assert, which appears to only be available on JVM and native.

So, I tried to use check instead, which works, but shows the diagram twice:

  @Test
  fun foo() {
    check("foo" == "bar") { "Failed foo=bar" }
  }
Failed foo=bar
check("foo" == "bar") { "Failed foo=bar" }
            |
            false
java.lang.IllegalStateException: Failed foo=bar
check("foo" == "bar") { "Failed foo=bar" }
            |
            false

Also shows twice if the lazyMessage param is not given.

I think this may be an IDE oddity, rather than something specific to kotlin-power-assert. I think your IDE (looks like an output from IntelliJ) is showing you the message of the exception the test is failing with and then dumping the stacktrace of the exception which also includes the error message. I suspect if you remove kotlin-power-assert from your build you will observe the same behavior, just without the diagram.

I think this may be an IDE oddity, rather than something specific to kotlin-power-assert.

Yep, you're right. Weird that I've never noticed that before. Sorry for the noise!

More context if anyone else comes upon this in the future: