Skip to content

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Nov 6, 2024
1 parent 5bfdb30 commit bbc1ec8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-expect-self-test.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,19 @@ test_that("show_failure", {
expect_null(show_failure(NULL))
expect_output(show_failure(expect_true(FALSE)), "FALSE is not TRUE")
})

test_that("can test for presence and absense of failure", {
expect_success(expect_failure(fail()))
expect_success(expect_no_failure(succeed()))

expect_failure(expect_failure(succeed()))
expect_failure(expect_no_failure(fail()))
})

test_that("can test for presence and absense of success", {
expect_success(expect_success(succeed()))
expect_success(expect_no_success(fail()))

expect_failure(expect_success(fail()))
expect_failure(expect_no_success(succeed()))
})

0 comments on commit bbc1ec8

Please sign in to comment.