|
1 | | -#' Expect that a condition holds. |
2 | | -#' |
3 | | -#' @description |
4 | | -#' `r lifecycle::badge("superseded")` |
5 | | -#' |
6 | | -#' An old style of testing that's no longer encouraged. |
7 | | -#' |
8 | | -#' @section 3rd edition: |
9 | | -#' `r lifecycle::badge("deprecated")` |
10 | | -#' |
11 | | -#' This style of testing is formally deprecated as of the 3rd edition. |
12 | | -#' Use a more specific `expect_` function instead. |
13 | | -#' |
14 | | -#' @param object Object to test. |
15 | | -#' |
16 | | -#' Supports limited unquoting to make it easier to generate readable failures |
17 | | -#' within a function or for loop. See [quasi_label] for more details. |
18 | | -#' @param condition, a function that returns whether or not the condition |
19 | | -#' is met, and if not, an error message to display. |
20 | | -#' @param label Used to customise failure messages. For expert use only. |
21 | | -#' @param info Extra information to be included in the message. This argument |
22 | | -#' is soft-deprecated and should not be used in new code. Instead see |
23 | | -#' alternatives in [quasi_label]. |
24 | | -#' @return the (internal) expectation result as an invisible list |
25 | | -#' @keywords internal |
26 | | -#' @export |
27 | | -#' @seealso [fail()] for an expectation that always fails. |
28 | | -#' @examples |
29 | | -#' expect_that(5 * 2, equals(10)) |
30 | | -#' expect_that(sqrt(2) ^ 2, equals(2)) |
31 | | -#' \dontrun{ |
32 | | -#' expect_that(sqrt(2) ^ 2, is_identical_to(2)) |
33 | | -#' } |
34 | | -expect_that <- function(object, condition, info = NULL, label = NULL) { |
35 | | - edition_deprecate(3, "expect_that()") |
36 | | - condition(object) |
37 | | -} |
38 | | - |
39 | 1 | #' `pass()` or `fail()` a test |
40 | 2 | #' |
41 | 3 | #' @description |
|
0 commit comments