我已经开始使用kotest:4.0.5(kotlintest),并且对嵌套在stringSpec
子句中的describe
函数有疑问。
示例:
class SellerTest : DescribeSpec({
describe("Registration") {
context("Not existing user") {
include(emailValidation()
}
}
})
fun emailValidation() = stringSpec {
"Email validation" {
forAll(
row("test.com"),row("123123123123123")
) { email ->
assertsoftly {
val exception =
shouldThrow<ServiceException> { Email(email) }
}
}
}
}
如果include(emailValidation())
在describe
子句之外,则可以正常工作。
您知道如何在子句中嵌套规范/功能吗?