diff --git a/NEWS.md b/NEWS.md index bf194540f7..661898f902 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal 0.14.0.9018 +# teal 0.14.0.9019 ### New features diff --git a/R/validations.R b/R/validations.R index 81e13554eb..6a85aecea6 100644 --- a/R/validations.R +++ b/R/validations.R @@ -43,10 +43,8 @@ validate_has_data <- function(x, complete = FALSE, allow_inf = TRUE, msg = NULL) { - stopifnot( - "Please provide a character vector in msg argument of validate_has_data." = is.character(msg) || is.null(msg) - ) - validate(need(!is.null(x) && is.data.frame(x), "No data left.")) + checkmate::assert_string(msg, null.ok = TRUE) + checkmate::assert_data_frame(x) if (!is.null(min_nrow)) { if (complete) { complete_index <- stats::complete.cases(x) diff --git a/tests/testthat/test-validate_has_data.R b/tests/testthat/test-validate_has_data.R index 35e0920a5e..25e4379db0 100644 --- a/tests/testthat/test-validate_has_data.R +++ b/tests/testthat/test-validate_has_data.R @@ -55,11 +55,11 @@ testthat::test_that("validate_has_data returns message msg argument is set and c testthat::test_that("validate_has_data returns throws error with non-character msg input", { testthat::expect_error( validate_has_data(data, 10, msg = 1), - "Please provide a character vector in msg argument of validate_has_data." + "Assertion on 'msg' failed: Must be of type 'string' \\(or 'NULL'\\), not 'double'" ) testthat::expect_error( validate_has_data(data, 10, msg = TRUE), - "Please provide a character vector in msg argument of validate_has_data." + "Assertion on 'msg' failed: Must be of type 'string' \\(or 'NULL'\\), not 'logical'." ) })