如果我跟随,行为是预期的。没有返回任何东西
expect_error(expect_true(FALSE))
当我运行相同的代码,但包裹在里面test_that
test_that("expect_error should not fail",{
expect_error(expect_true(FALSE))
})
Error: Test failed: 'expect_error should not fail'
* Not expected: FALSE isn't true.
* Not expected: expect_true(FALSE) code did not generate an error.
输出很奇怪,这意味着expect_true(FALSE)
折叠时不会产生错误test_that
。
怎么放expect_error
里面test_that
?
更新
我用于testthat
代码断言。有包assertthat
。