diff --git a/R/expect-that.R b/R/expect-that.R index eefe836e9..b11d726e8 100644 --- a/R/expect-that.R +++ b/R/expect-that.R @@ -63,29 +63,3 @@ fail <- function( succeed <- function(message = "Success has been forced", info = NULL) { expect(TRUE, message, info = info) } - -#' Negate an expectation -#' -#' This negates an expectation, making it possible to express that you -#' want the opposite of a standard expectation. This function is deprecated -#' and will be removed in a future version. -#' -#' @param f an existing expectation function -#' @keywords internal -#' @export -not <- function(f) { - warning("`not()` is deprecated.", call. = FALSE) - stopifnot(is.function(f)) - - negate <- function(expt) { - expect( - !expectation_success(expt), - failure_message = paste0("NOT(", expt$message, ")"), - srcref = expt$srcref - ) - } - - function(...) { - negate(capture_expectation(f(...))) - } -} diff --git a/R/old-school.R b/R/old-school.R index c8cd38ad5..3254b82b7 100644 --- a/R/old-school.R +++ b/R/old-school.R @@ -160,3 +160,29 @@ takes_less_than <- function(amount) { ) } } + +#' Negate an expectation +#' +#' This negates an expectation, making it possible to express that you +#' want the opposite of a standard expectation. This function is deprecated +#' and will be removed in a future version. +#' +#' @param f an existing expectation function +#' @keywords internal +#' @export +not <- function(f) { + warning("`not()` is deprecated.", call. = FALSE) + stopifnot(is.function(f)) + + negate <- function(expt) { + expect( + !expectation_success(expt), + failure_message = paste0("NOT(", expt$message, ")"), + srcref = expt$srcref + ) + } + + function(...) { + negate(capture_expectation(f(...))) + } +} diff --git a/man/not.Rd b/man/not.Rd index 6d42a4b4b..4ed465613 100644 --- a/man/not.Rd +++ b/man/not.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/expect-that.R +% Please edit documentation in R/old-school.R \name{not} \alias{not} \title{Negate an expectation}