Skip to content

Commit

Permalink
Merge pull request #946 from bossm0n5t3r/feature/add-missing-test-ann…
Browse files Browse the repository at this point in the history
…otation-to-lambda-test

Add missing test annotation to LambdaTest
  • Loading branch information
Raibaz committed Oct 10, 2022
2 parents 5116633 + 755076e commit 098b3aa
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/mockk/src/commonTest/kotlin/io/mockk/it/LambdaTest.kt
Expand Up @@ -4,25 +4,26 @@ import io.mockk.every
import io.mockk.invoke
import io.mockk.mockk
import io.mockk.verify
import kotlin.test.Test
import kotlin.test.assertEquals

class LambdaTest {
val mock = mockk<MockCls>()
private val mock = mockk<MockCls>()

fun lambdaTest() {
@Test
fun simpleLambdaTest() {
every {
mock.lambdaOp(1, captureLambda())
} answers { 1 - lambda<() -> Int>().invoke() }

assertEquals(-4, mock.lambdaOp(1, { 5 }))
assertEquals(-4, mock.lambdaOp(1) { 5 })

verify {
mock.lambdaOp(1, any())
}

}

class MockCls {
fun lambdaOp(a: Int, b: () -> Int) = a + b()
}
}
}

0 comments on commit 098b3aa

Please sign in to comment.