Skip to content

Commit 5f6c810

Browse files
authored
Move not() to old-school.R (#2123)
1 parent 854fde2 commit 5f6c810

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

R/expect-that.R

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,3 @@ fail <- function(
6363
succeed <- function(message = "Success has been forced", info = NULL) {
6464
expect(TRUE, message, info = info)
6565
}
66-
67-
#' Negate an expectation
68-
#'
69-
#' This negates an expectation, making it possible to express that you
70-
#' want the opposite of a standard expectation. This function is deprecated
71-
#' and will be removed in a future version.
72-
#'
73-
#' @param f an existing expectation function
74-
#' @keywords internal
75-
#' @export
76-
not <- function(f) {
77-
warning("`not()` is deprecated.", call. = FALSE)
78-
stopifnot(is.function(f))
79-
80-
negate <- function(expt) {
81-
expect(
82-
!expectation_success(expt),
83-
failure_message = paste0("NOT(", expt$message, ")"),
84-
srcref = expt$srcref
85-
)
86-
}
87-
88-
function(...) {
89-
negate(capture_expectation(f(...)))
90-
}
91-
}

R/old-school.R

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,29 @@ takes_less_than <- function(amount) {
160160
)
161161
}
162162
}
163+
164+
#' Negate an expectation
165+
#'
166+
#' This negates an expectation, making it possible to express that you
167+
#' want the opposite of a standard expectation. This function is deprecated
168+
#' and will be removed in a future version.
169+
#'
170+
#' @param f an existing expectation function
171+
#' @keywords internal
172+
#' @export
173+
not <- function(f) {
174+
warning("`not()` is deprecated.", call. = FALSE)
175+
stopifnot(is.function(f))
176+
177+
negate <- function(expt) {
178+
expect(
179+
!expectation_success(expt),
180+
failure_message = paste0("NOT(", expt$message, ")"),
181+
srcref = expt$srcref
182+
)
183+
}
184+
185+
function(...) {
186+
negate(capture_expectation(f(...)))
187+
}
188+
}

man/not.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.

0 commit comments

Comments
 (0)