```inline infix fun <reified T> (() -> T)...
# kotest-contributors
e
Copy code
inline infix fun <reified T> (() -> T).shouldReturn(expected: T) = this() shouldBe expected
worth adding?
Could, of course, be a bit more elaborate and include a tailored failure message etc..
m
hmmm what’s the use case? I wonder if it can be written as this one instead?
Copy code
run { ... } shouldBe expected
e
Hmm, I had a case where I wanted to test a list of
Pair<Int, () -> String>
using something like
Copy code
items.forOne {
  it.first shouldBe 5
  it.second shouldReturn "hello"
}
I made some custom matchers later on so it's a non-issue for me now.. anyway.. you're right, I could've done this. 🙂
Copy code
items.forOne {
  it.first shouldBe 5
  run(it.second) shouldBe "hello"
}
or just
it.second() shouldBe "hello"