我正试着在我们的测试项目中开始运行。
虽然它编译和运行良好,但我只想确保它真的正常工作。所以我给了它一个失败的案例,它通过了。
我错过了什么傻事吗?
我的测试装置
let tests =
testList "Test Group" [
test "Testing fail test" {
let result = false
Expecto.Expect.isTrue result
}
]
let runTests args =
runTestsWithArgs defaultConfig args tests测试输出
[08:52:06 INF] EXPECTO? Running tests...
[08:52:06 INF] EXPECTO! 1 tests run in 00:00:00.0569286 – 1 passed, 0 ignored, 0 failed, 0 errored. ᕙ໒( ˵ ಠ ╭͜ʖ╮ ಠೃ ˵ )७ᕗ发布于 2017-06-05 13:17:23
所有Expecto.Expect函数的末尾都有一个字符串参数,即失败时要打印的消息。您没有提供该参数,因此您的Expecto.Expect.isTrue result表达式具有string -> unit类型:它还没有真正调用isTrue。(您应该在IDE中看到该表达式下面的绿色波浪线,表示该值被忽略)。向您的调用中添加一个字符串,比如Expecto.Expect.isTrue result "should fail",那么您的测试就会失败。
https://stackoverflow.com/questions/44369419
复制相似问题