You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given the following minimal example, I do not get information in the output about the obvious error in expect_equal(n, n + 1) but only see as expected in the output:
library(testthat)
library(hedgehog)
test_that("Demo: shows 'as expected' as error message", {
forall(
gen.element(1:10),
function (n) {
expect_equal(n, n+1)
# The last expect is shown as "error", in this case the message is "as expected"# Information of the above failing expect is swallowed.
expect_equal(n, n)
}
)
})
The output:
-- FAILURE (???): Demo: shows 'as expected' as error message -------------------
Falsifiable after 1 tests, and 1 shrinks
As expected
Counterexample:
[1] 1
Given the following minimal example, I do not get information in the output about the obvious error in
expect_equal(n, n + 1)
but only seeas expected
in the output:The output:
(this can be directly reproduced in e.g. https://rdrr.io/snippets/)
The last
expect
succeeds and this is where the strange "failure" message ofAs expected
presumably comes from.If we switch the expects, I get again the result of the last expect, which in the example below is at least actually failing:
output:
However I only see one failing expect, even though there are two failing in the test.
Expected behaviour
Provide information about every failing expect, like testthat does by default, and don't show information about succeeding expects:
output:
The text was updated successfully, but these errors were encountered: