Skip to content

Commit 8b6bf16

Browse files
committed
Use in expect_true()
1 parent 2aed10c commit 8b6bf16

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

R/expect-constant.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
#' @examples
1313
#' expect_true(2 == 2)
1414
#' # Failed expectations will throw an error
15-
#' \dontrun{
16-
#' expect_true(2 != 2)
17-
#' }
18-
#' expect_true(!(2 != 2))
19-
#' # or better:
20-
#' expect_false(2 != 2)
15+
#' show_failure(expect_true(2 != 2))
2116
#'
22-
#' a <- 1:3
23-
#' expect_true(length(a) == 3)
24-
#' # but better to use more specific expectation, if available
25-
#' expect_equal(length(a), 3)
17+
#' # where possible, use more specific expectations, to get more informative
18+
#' # error messages
19+
#' a <- 1:4
20+
#' show_failure(expect_true(length(a) == 3))
21+
#' show_failure(expect_equal(length(a), 3))
22+
#'
23+
#' x <- c(TRUE, TRUE, FALSE, TRUE)
24+
#' show_failure(expect_true(all(x)))
25+
#' show_failure(expect_all_true(x))
2626
#' @name logical-expectations
2727
NULL
2828

man/expect_all_equal.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/logical-expectations.Rd

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)