Skip to content

Commit 1fb89e8

Browse files
committed
Add assert_environment()
1 parent 2695e0d commit 1fb89e8

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export(assert_day)
2020
export(assert_dnumber)
2121
export(assert_dots_empty)
2222
export(assert_double)
23+
export(assert_environment)
2324
export(assert_factor)
2425
export(assert_flag)
2526
export(assert_int)
@@ -60,6 +61,7 @@ importFrom(checkmate,check_data_frame)
6061
importFrom(checkmate,check_data_table)
6162
importFrom(checkmate,check_date)
6263
importFrom(checkmate,check_double)
64+
importFrom(checkmate,check_environment)
6365
importFrom(checkmate,check_factor)
6466
importFrom(checkmate,check_flag)
6567
importFrom(checkmate,check_int)

R/assertions.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' check_numeric check_logical check_character check_raw check_date
55
#' check_integerish check_complex check_factor qtest test_integer
66
#' check_list check_data_frame check_data_table check_tibble
7-
#' check_scalar check_atomic
7+
#' check_scalar check_atomic check_environment
88
NULL
99

1010
#' @importFrom rlang arg_match seq2 abort
@@ -391,3 +391,10 @@ assert_choice <- function(x, choices, ...) {
391391
invisible(x)
392392
}
393393

394+
#' @rdname checkmate_rlang_values
395+
#' @export
396+
assert_environment <- function(x, ...) {
397+
if (!isTRUE(check_environment(x, ...)))
398+
rlang::abort(check_environment(x, ...))
399+
invisible(x)
400+
}

man/checkmate_rlang_values.Rd

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

0 commit comments

Comments
 (0)