From b2ee12d8e9a6da6adda26e467c061a9d727adadb Mon Sep 17 00:00:00 2001 From: selkamand Date: Thu, 11 Jan 2024 23:47:52 +1100 Subject: [PATCH] fix: updated snapshots to work with new version of testthat --- tests/testthat/_snaps/assert_compare.md | 230 +++++++++++++--------- tests/testthat/_snaps/assert_create.md | 45 +++-- tests/testthat/_snaps/assert_files.md | 135 ++++++++----- tests/testthat/_snaps/assert_functions.md | 20 +- tests/testthat/_snaps/assert_includes.md | 45 +++-- tests/testthat/_snaps/assert_numerical.md | 25 ++- tests/testthat/_snaps/assert_set.md | 15 +- tests/testthat/_snaps/assert_type.md | 90 +++++---- tests/testthat/_snaps/has.md | 25 ++- 9 files changed, 379 insertions(+), 251 deletions(-) diff --git a/tests/testthat/_snaps/assert_compare.md b/tests/testthat/_snaps/assert_compare.md index 51982bb..354205d 100644 --- a/tests/testthat/_snaps/assert_compare.md +++ b/tests/testthat/_snaps/assert_compare.md @@ -2,321 +2,367 @@ Code assert_greater_than(c(2, 3, 1), 3) - Error - 'c(2, 3, 1)' is not a number! (length is 3, not 1) + Condition + Error: + ! 'c(2, 3, 1)' is not a number! (length is 3, not 1) --- Code assert_greater_than(c(2, 3, 4), 2) - Error - 'c(2, 3, 4)' is not a number! (length is 3, not 1) + Condition + Error: + ! 'c(2, 3, 4)' is not a number! (length is 3, not 1) --- Code assert_greater_than("abc", 2) - Error - '"abc"' is not a number! (class is character, not numeric) + Condition + Error: + ! '"abc"' is not a number! (class is character, not numeric) --- Code assert_greater_than(list(1, 2, 3), 2) - Error - 'list(1, 2, 3)' is not a number! (class is list, not numeric) + Condition + Error: + ! 'list(1, 2, 3)' is not a number! (class is list, not numeric) --- Code assert_greater_than(c(3, 4, 5), 2) - Error - 'c(3, 4, 5)' is not a number! (length is 3, not 1) + Condition + Error: + ! 'c(3, 4, 5)' is not a number! (length is 3, not 1) --- Code assert_greater_than(factor(4), 2) - Error - 'factor(4)' is not a number! (class is factor, not numeric) + Condition + Error: + ! 'factor(4)' is not a number! (class is factor, not numeric) --- Code assert_greater_than(TRUE, 2) - Error - 'TRUE' is not a number! (class is logical, not numeric) + Condition + Error: + ! 'TRUE' is not a number! (class is logical, not numeric) --- Code assert_greater_than(NULL, 2) - Error - 'NULL' is not a number! (class is NULL, not numeric) + Condition + Error: + ! 'NULL' is not a number! (class is NULL, not numeric) # assert_all_greater_than() works [plain] Code assert_all_greater_than(c(2, 3, 1), 3) - Error - c(2, 3, 1) must all be greater than `3`. + Condition + Error: + ! c(2, 3, 1) must all be greater than `3`. --- Code assert_all_greater_than(c(2, 3, 4), 2) - Error - c(2, 3, 4) must all be greater than `2`. + Condition + Error: + ! c(2, 3, 4) must all be greater than `2`. --- Code assert_all_greater_than(2, 2) - Error - 2 must be greater than `2`. + Condition + Error: + ! 2 must be greater than `2`. --- Code assert_all_greater_than("abc", 2) - Error - '"abc"' must be numeric, not a character + Condition + Error: + ! '"abc"' must be numeric, not a character --- Code assert_all_greater_than(list(1, 2, 3), 2) - Error - 'list(1, 2, 3)' must be numeric, not a list + Condition + Error: + ! 'list(1, 2, 3)' must be numeric, not a list --- Code assert_all_greater_than(c(1, 2, 3), 2) - Error - c(1, 2, 3) must all be greater than `2`. + Condition + Error: + ! c(1, 2, 3) must all be greater than `2`. --- Code assert_all_greater_than(factor(c(1, 2, 3)), 2) - Error - 'factor(c(1, 2, 3))' must be numeric, not a factor + Condition + Error: + ! 'factor(c(1, 2, 3))' must be numeric, not a factor --- Code assert_all_greater_than(TRUE, 2) - Error - 'TRUE' must be numeric, not a logical + Condition + Error: + ! 'TRUE' must be numeric, not a logical --- Code assert_all_greater_than(NULL, 2) - Error - 'NULL' must be numeric, not a NULL + Condition + Error: + ! 'NULL' must be numeric, not a NULL # assert_all_greater_than_or_equal_to() works [plain] Code assert_all_greater_than_or_equal_to(c(2, 3, 1), 3) - Error - c(2, 3, 1) must all be greater than or equal to `3`. + Condition + Error: + ! c(2, 3, 1) must all be greater than or equal to `3`. --- Code assert_all_greater_than_or_equal_to("abc", 2) - Error - '"abc"' must be numeric, not a character + Condition + Error: + ! '"abc"' must be numeric, not a character --- Code assert_all_greater_than_or_equal_to(list(1, 2, 3), 2) - Error - 'list(1, 2, 3)' must be numeric, not a list + Condition + Error: + ! 'list(1, 2, 3)' must be numeric, not a list --- Code assert_all_greater_than_or_equal_to(c(1, 2, 3), 2) - Error - c(1, 2, 3) must all be greater than or equal to `2`. + Condition + Error: + ! c(1, 2, 3) must all be greater than or equal to `2`. --- Code assert_all_greater_than_or_equal_to(factor(c(1, 2, 3)), 2) - Error - 'factor(c(1, 2, 3))' must be numeric, not a factor + Condition + Error: + ! 'factor(c(1, 2, 3))' must be numeric, not a factor --- Code assert_all_greater_than_or_equal_to(TRUE, 2) - Error - 'TRUE' must be numeric, not a logical + Condition + Error: + ! 'TRUE' must be numeric, not a logical --- Code assert_all_greater_than_or_equal_to(NULL, 2) - Error - 'NULL' must be numeric, not a NULL + Condition + Error: + ! 'NULL' must be numeric, not a NULL --- Code assert_all_greater_than_or_equal_to(NA, 3) - Error - 'NA' must be numeric, not a logical + Condition + Error: + ! 'NA' must be numeric, not a logical --- Code assert_all_greater_than_or_equal_to(c(4, NA), 3) - Error - 'c(4, NA)' must have no missing values! Found 1 + Condition + Error in `compare()`: + ! 'c(4, NA)' must have no missing values! Found 1 # assert_greater_than_or_equal_to() works [plain] Code assert_greater_than_or_equal_to(2, 3) - Error - 2 must be greater than or equal to `3`. + Condition + Error: + ! 2 must be greater than or equal to `3`. --- Code assert_greater_than_or_equal_to("abc", 2) - Error - '"abc"' is not a number! (class is character, not numeric) + Condition + Error: + ! '"abc"' is not a number! (class is character, not numeric) --- Code assert_greater_than_or_equal_to(list(1, 2, 3), 2) - Error - 'list(1, 2, 3)' is not a number! (class is list, not numeric) + Condition + Error: + ! 'list(1, 2, 3)' is not a number! (class is list, not numeric) --- Code assert_greater_than_or_equal_to(c(3, 2, 3), 2) - Error - 'c(3, 2, 3)' is not a number! (length is 3, not 1) + Condition + Error: + ! 'c(3, 2, 3)' is not a number! (length is 3, not 1) --- Code assert_greater_than_or_equal_to(factor(1), 2) - Error - 'factor(1)' is not a number! (class is factor, not numeric) + Condition + Error: + ! 'factor(1)' is not a number! (class is factor, not numeric) --- Code assert_greater_than_or_equal_to(TRUE, 2) - Error - 'TRUE' is not a number! (class is logical, not numeric) + Condition + Error: + ! 'TRUE' is not a number! (class is logical, not numeric) --- Code assert_greater_than(NULL, 2) - Error - 'NULL' is not a number! (class is NULL, not numeric) + Condition + Error: + ! 'NULL' is not a number! (class is NULL, not numeric) --- Code assert_greater_than_or_equal_to(NA, 3) - Error - 'NA' is not a number! (class is logical, not numeric) + Condition + Error: + ! 'NA' is not a number! (class is logical, not numeric) --- Code assert_greater_than_or_equal_to(c(4, NA), 3) - Error - 'c(4, NA)' is not a number! (length is 2, not 1) + Condition + Error: + ! 'c(4, NA)' is not a number! (length is 2, not 1) # assert_identical() works [plain] Code assert_identical(c(3, 3, 3), 3) - Error - c(3, 3, 3) must be identical to 3 + Condition + Error: + ! c(3, 3, 3) must be identical to 3 --- Code assert_identical(3, 4) - Error - 3 must be identical to 4 + Condition + Error: + ! 3 must be identical to 4 --- Code assert_identical(c(1, 2, 3), 3) - Error - c(1, 2, 3) must be identical to 3 + Condition + Error: + ! c(1, 2, 3) must be identical to 3 --- Code assert_identical(list(1, 2, 3), list(1, 2, 4)) - Error - list(1, 2, 3) must be identical to list(1, 2, 4) + Condition + Error: + ! list(1, 2, 3) must be identical to list(1, 2, 4) --- Code assert_identical(x = length(1:3), y = 3) - Error - length(1:3) must be identical to 3 + Condition + Error: + ! length(1:3) must be identical to 3 --- Code assert_identical(c(a = 3), c(b = 3)) - Error - c(a = 3) must be identical to c(b = 3) + Condition + Error: + ! c(a = 3) must be identical to c(b = 3) # assert_equal() works [plain] Code assert_equal(c(3, 3, 3), 3) - Error - c(3, 3, 3) must be equal to 3 + Condition + Error: + ! c(3, 3, 3) must be equal to 3 --- Code assert_equal(3, 4) - Error - 3 must be equal to 4 + Condition + Error: + ! 3 must be equal to 4 --- Code assert_equal(c(1, 2, 3), 3) - Error - c(1, 2, 3) must be equal to 3 + Condition + Error: + ! c(1, 2, 3) must be equal to 3 --- Code assert_equal(list(1, 2, 3), list(1, 2, 4)) - Error - list(1, 2, 3) must be equal to list(1, 2, 4) + Condition + Error: + ! list(1, 2, 3) must be equal to list(1, 2, 4) --- Code assert_equal(c(a = 3), c(b = 3), check_names = TRUE) - Error - c(a = 3) must be equal to c(b = 3) + Condition + Error: + ! c(a = 3) must be equal to c(b = 3) diff --git a/tests/testthat/_snaps/assert_create.md b/tests/testthat/_snaps/assert_create.md index 131cb14..1fa5691 100644 --- a/tests/testthat/_snaps/assert_create.md +++ b/tests/testthat/_snaps/assert_create.md @@ -2,62 +2,71 @@ Code assert_is_numeric(2) - Error - Assertion Function `function(x) x` must return TRUE if assertion passes and FALSE or a String if assertion should fail. Instead returned: `2` + Condition + Error in `assert_is_numeric()`: + ! Assertion Function `function(x) x` must return TRUE if assertion passes and FALSE or a String if assertion should fail. Instead returned: `2` # assertion function aborts if func returns FALSE without a default error message [plain] Code bad_assert_no_default_error(2) - Error - Assertion Function `function(x) FALSE` returned FALSE, indicating assertion should fail, however no `default_error_msg` was supplied! Please add a `default_error_msg` to your assert_create call, or change function to return a string describing the error instead of `FALSE` + Condition + Error in `bad_assert_no_default_error()`: + ! Assertion Function `function(x) FALSE` returned FALSE, indicating assertion should fail, however no `default_error_msg` was supplied! Please add a `default_error_msg` to your assert_create call, or change function to return a string describing the error instead of `FALSE` --- Code good_assert_no_default_error(2) - Error - an error message + Condition + Error: + ! an error message # assertion function throws appropriate error when returning neither a flag NOR a string [plain] Code bad_assert_returns_char("foo") - Error - Assertion Function `function(x) c("a", "b")` must return TRUE if assertion passes and FALSE or a String if assertion should fail. Instead returned: `a and b` + Condition + Error in `bad_assert_returns_char()`: + ! Assertion Function `function(x) c("a", "b")` must return TRUE if assertion passes and FALSE or a String if assertion should fail. Instead returned: `a and b` --- Code bad_assert_returns_logical("foo") - Error - Assertion Function `function(x) c(TRUE, TRUE)` must return TRUE if assertion passes and FALSE or a String if assertion should fail. Instead returned: `TRUE and TRUE` + Condition + Error in `bad_assert_returns_logical()`: + ! Assertion Function `function(x) c(TRUE, TRUE)` must return TRUE if assertion passes and FALSE or a String if assertion should fail. Instead returned: `TRUE and TRUE` --- Code bad_assert_returns_factor("foo") - Error - Assertion Function `function(x) factor(c(1, 4))` must return TRUE if assertion passes and FALSE or a String if assertion should fail. Instead returned: `1 and 4` + Condition + Error in `bad_assert_returns_factor()`: + ! Assertion Function `function(x) factor(c(1, 4))` must return TRUE if assertion passes and FALSE or a String if assertion should fail. Instead returned: `1 and 4` # assertion function works as expected with string-returning assertion functions [plain] Code assert_between_min_and_max("foo", min = 3, max = 5) - Error - "foo" is a character, not numeric + Condition + Error: + ! "foo" is a character, not numeric --- Code assert_between_min_and_max(6, min = 3, max = 5) - Error - 6 is over 5 + Condition + Error: + ! 6 is over 5 --- Code assert_between_min_and_max(2, min = 3, max = 5) - Error - 2 is under 3 + Condition + Error: + ! 2 is under 3 diff --git a/tests/testthat/_snaps/assert_files.md b/tests/testthat/_snaps/assert_files.md index dc76da2..df91a1a 100644 --- a/tests/testthat/_snaps/assert_files.md +++ b/tests/testthat/_snaps/assert_files.md @@ -2,190 +2,217 @@ Code assert_file_exists(c("sdasda", "file2")) - Error - 'c("sdasda", "file2")' is not a string! (length is 2, not 1) + Condition + Error: + ! 'c("sdasda", "file2")' is not a string! (length is 2, not 1) --- Code assert_file_exists(2) - Error - '2' is not a string! (class is numeric, not character) + Condition + Error: + ! '2' is not a string! (class is numeric, not character) --- Code assert_file_exists(c(dirpath, dirpath2)) - Error - 'c(dirpath, dirpath2)' is not a string! (length is 2, not 1) + Condition + Error: + ! 'c(dirpath, dirpath2)' is not a string! (length is 2, not 1) # assert_all_files_exist() works Code assert_all_files_exist(c("sdasda", "file2")) - Error - Failed to find files: 'sdasda' and 'file2' + Condition + Error: + ! Failed to find files: 'sdasda' and 'file2' --- Code assert_all_files_exist(2) - Error - '2' must be a character vector, not a numeric + Condition + Error: + ! '2' must be a character vector, not a numeric --- Code assert_all_files_exist(c("sdasda", "file2")) - Error - Failed to find files: 'sdasda' and 'file2' + Condition + Error: + ! Failed to find files: 'sdasda' and 'file2' # assert_directory_exists() works Code assert_directory_exists("asdasdaw") - Error - Failed to find directory: 'asdasdaw' + Condition + Error: + ! Failed to find directory: 'asdasdaw' --- Code assert_directory_exists(100) - Error - '100' is not a string! (class is numeric, not character) + Condition + Error: + ! '100' is not a string! (class is numeric, not character) --- Code assert_directory_exists(c("asdasdaw", "adwadwad")) - Error - 'c("asdasdaw", "adwadwad")' is not a string! (length is 2, not 1) + Condition + Error: + ! 'c("asdasdaw", "adwadwad")' is not a string! (length is 2, not 1) --- Code assert_directory_exists(c(dirpath, dirpath2)) - Error - 'c(dirpath, dirpath2)' is not a string! (length is 2, not 1) + Condition + Error: + ! 'c(dirpath, dirpath2)' is not a string! (length is 2, not 1) # assert_all_directories_exist() works Code assert_all_directories_exist("asdasdaw") - Error - Failed to find directory: 'asdasdaw' + Condition + Error: + ! Failed to find directory: 'asdasdaw' --- Code assert_all_directories_exist(c("asdasdaw", "adwadwad")) - Error - Failed to find directories: 'asdasdaw' and 'adwadwad' + Condition + Error: + ! Failed to find directories: 'asdasdaw' and 'adwadwad' --- Code assert_all_directories_exist(100) - Error - '100' must be a character, not a numeric + Condition + Error: + ! '100' must be a character, not a numeric # assert_file_has_extension() works Code assert_file_has_extension(c("file.ext.gz", "file.ext"), extensions = "ext", compression = TRUE) - Error - 'c("file.ext.gz", "file.ext")' is not a string! (length is 2, not 1) + Condition + Error: + ! 'c("file.ext.gz", "file.ext")' is not a string! (length is 2, not 1) --- Code assert_file_has_extension(c("file.fns", "billy.fasta", "bob.fa", "billy.fa"), extensions = c("fasta", "fa", "fns")) - Error - 'c("file.fns", "billy.fasta", "bob.fa", "billy.fa")' is not a string! (length is 4, not 1) + Condition + Error: + ! 'c("file.fns", "billy.fasta", "bob.fa", "billy.fa")' is not a string! (length is 4, not 1) --- Code assert_file_has_extension("file.ext", extensions = "bob") - Error - '"file.ext"' has an invalid extension (required extension/s: bob). The following file has an unexpected extension: [file.ext] + Condition + Error: + ! '"file.ext"' has an invalid extension (required extension/s: bob). The following file has an unexpected extension: [file.ext] --- Code assert_file_has_extension("file.ADSAWD", extensions = "ext", compression = TRUE) - Error - '"file.ADSAWD"' has an invalid extension (required extension/s: ext). The following file has an unexpected extension: [file.ADSAWD] + Condition + Error: + ! '"file.ADSAWD"' has an invalid extension (required extension/s: ext). The following file has an unexpected extension: [file.ADSAWD] --- Code assert_file_has_extension("bob.blablaext", extensions = "ext") - Error - '"bob.blablaext"' has an invalid extension (required extension/s: ext). The following file has an unexpected extension: [bob.blablaext] + Condition + Error: + ! '"bob.blablaext"' has an invalid extension (required extension/s: ext). The following file has an unexpected extension: [bob.blablaext] --- Code assert_file_has_extension(c(TRUE), extensions = "ext") - Error - 'c(TRUE)' is not a string! (class is logical, not character) + Condition + Error: + ! 'c(TRUE)' is not a string! (class is logical, not character) # assert_all_files_have_extension() works Code assert_all_files_have_extension("file.ext", extensions = "bob") - Error - '"file.ext"' has an invalid extension (required extension/s: bob). The following file has an unexpected extension: [file.ext] + Condition + Error: + ! '"file.ext"' has an invalid extension (required extension/s: bob). The following file has an unexpected extension: [file.ext] --- Code assert_all_files_have_extension("file.ADSAWD", extensions = "ext", compression = TRUE) - Error - '"file.ADSAWD"' has an invalid extension (required extension/s: ext). The following file has an unexpected extension: [file.ADSAWD] + Condition + Error: + ! '"file.ADSAWD"' has an invalid extension (required extension/s: ext). The following file has an unexpected extension: [file.ADSAWD] --- Code assert_all_files_have_extension("bob.blablaext", extensions = "ext") - Error - '"bob.blablaext"' has an invalid extension (required extension/s: ext). The following file has an unexpected extension: [bob.blablaext] + Condition + Error: + ! '"bob.blablaext"' has an invalid extension (required extension/s: ext). The following file has an unexpected extension: [bob.blablaext] --- Code assert_all_files_have_extension(c(TRUE), extensions = "ext") - Error - 'c(TRUE)' must be a character, not a logical + Condition + Error: + ! 'c(TRUE)' must be a character, not a logical # assert_file_does_not_exist() works Code assert_file_does_not_exist(c("foo", "bar")) - Error - 'c("foo", "bar")' is not a string! (length is 2, not 1) + Condition + Error: + ! 'c("foo", "bar")' is not a string! (length is 2, not 1) --- Code assert_file_does_not_exist(2) - Error - '2' is not a string! (class is numeric, not character) + Condition + Error: + ! '2' is not a string! (class is numeric, not character) # assert_directory_does_not_exist() works Code assert_directory_does_not_exist(c("foo", "bar")) - Error - 'c("foo", "bar")' is not a string! (length is 2, not 1) + Condition + Error: + ! 'c("foo", "bar")' is not a string! (length is 2, not 1) --- Code assert_directory_does_not_exist(2) - Error - '2' is not a string! (class is numeric, not character) + Condition + Error: + ! '2' is not a string! (class is numeric, not character) diff --git a/tests/testthat/_snaps/assert_functions.md b/tests/testthat/_snaps/assert_functions.md index 38f3ad9..5d96ffa 100644 --- a/tests/testthat/_snaps/assert_functions.md +++ b/tests/testthat/_snaps/assert_functions.md @@ -2,27 +2,31 @@ Code assert_function_expects_n_arguments(my_func_dots, 2, dots = "throw_error") - Error - 'my_func_dots' must not contain ... arguments + Condition + Error: + ! 'my_func_dots' must not contain ... arguments --- Code assert_function_expects_n_arguments(my_func2, 2) - Error - 'my_func2' must expect exactly 2 arguments, not 1 + Condition + Error: + ! 'my_func2' must expect exactly 2 arguments, not 1 --- Code assert_function_expects_n_arguments(123, 1) - Error - '123' must be a function, not a numeric + Condition + Error: + ! '123' must be a function, not a numeric --- Code assert_function_expects_n_arguments(c(1, 2, 3), 2) - Error - 'c(1, 2, 3)' must be a function, not a numeric + Condition + Error: + ! 'c(1, 2, 3)' must be a function, not a numeric diff --git a/tests/testthat/_snaps/assert_includes.md b/tests/testthat/_snaps/assert_includes.md index eeae92f..79d9154 100644 --- a/tests/testthat/_snaps/assert_includes.md +++ b/tests/testthat/_snaps/assert_includes.md @@ -2,62 +2,71 @@ Code assert_includes(c(1, 2, 3), c(4, 5)) - Error - 'c(1, 2, 3)' must include 4 and 5 + Condition + Error: + ! 'c(1, 2, 3)' must include 4 and 5 --- Code assert_includes(1, c(2, 3)) - Error - '1' must include 2 and 3 + Condition + Error: + ! '1' must include 2 and 3 --- Code assert_includes(1, c(1, 3)) - Error - '1' must include 3 + Condition + Error: + ! '1' must include 3 --- Code assert_includes("abc", "def") - Error - '"abc"' must include def + Condition + Error: + ! '"abc"' must include def --- Code assert_includes(c(1, 2, 3), c("A")) - Error - 'c(1, 2, 3)' (type: double) must be the same type as c("A") (type: character) + Condition + Error: + ! 'c(1, 2, 3)' (type: double) must be the same type as c("A") (type: character) # assert_excludes() works [plain] Code assert_excludes(c(1, 2, 3), c(1, 2)) - Error - 'c(1, 2, 3)' must exclude: 1 and 2 + Condition + Error: + ! 'c(1, 2, 3)' must exclude: 1 and 2 --- Code assert_excludes(1, c(1, 3)) - Error - '1' must exclude: 1 + Condition + Error: + ! '1' must exclude: 1 --- Code assert_excludes("abc", "abc") - Error - '"abc"' must exclude: abc + Condition + Error: + ! '"abc"' must exclude: abc --- Code assert_excludes(c(1, 2, 3), c("A")) - Error - 'c(1, 2, 3)' (type: double) must be the same type as c("A") (type: character) + Condition + Error: + ! 'c(1, 2, 3)' (type: double) must be the same type as c("A") (type: character) diff --git a/tests/testthat/_snaps/assert_numerical.md b/tests/testthat/_snaps/assert_numerical.md index 33aef96..03d6e3e 100644 --- a/tests/testthat/_snaps/assert_numerical.md +++ b/tests/testthat/_snaps/assert_numerical.md @@ -2,34 +2,39 @@ Code assert_whole_number(1.5) - Error - '1.5' is not a whole number + Condition + Error: + ! '1.5' is not a whole number --- Code assert_whole_number(0.5) - Error - '0.5' is not a whole number + Condition + Error: + ! '0.5' is not a whole number --- Code assert_whole_number(-1.5) - Error - '-1.5' is not a whole number + Condition + Error: + ! '-1.5' is not a whole number --- Code assert_whole_number("abc") - Error - '"abc"' is not a number! (class is character, not numeric) + Condition + Error: + ! '"abc"' is not a number! (class is character, not numeric) --- Code assert_whole_number(c(1, 2, 3)) - Error - 'c(1, 2, 3)' is not a number! (length is 3, not 1) + Condition + Error: + ! 'c(1, 2, 3)' is not a number! (length is 3, not 1) diff --git a/tests/testthat/_snaps/assert_set.md b/tests/testthat/_snaps/assert_set.md index 5d4da65..dce4a7b 100644 --- a/tests/testthat/_snaps/assert_set.md +++ b/tests/testthat/_snaps/assert_set.md @@ -2,34 +2,39 @@ Code assert_subset(c(4, 5), c(1, 2, 3)) - Error + Condition + Error: x 'c(4, 5)' contains invalid values: 4 and 5. Valid values include: 1, 2, and 3 --- Code assert_subset(c(2, 3), 1) - Error + Condition + Error: x 'c(2, 3)' contains invalid values: 2 and 3. Valid values include: 1 --- Code assert_subset(c(1, 3), c(2, 4)) - Error + Condition + Error: x 'c(1, 3)' contains invalid values: 1 and 3. Valid values include: 2 and 4 --- Code assert_subset("def", "abc") - Error + Condition + Error: x '"def"' contain an invalid value: def. Valid values include: abc --- Code assert_subset(c("A"), c(1, 2, 3)) - Error + Condition + Error: x 'c("A")' contain an invalid value: A. Valid values include: 1, 2, and 3 diff --git a/tests/testthat/_snaps/assert_type.md b/tests/testthat/_snaps/assert_type.md index 58a6c5a..63d6eed 100644 --- a/tests/testthat/_snaps/assert_type.md +++ b/tests/testthat/_snaps/assert_type.md @@ -2,125 +2,143 @@ Code assert_non_empty_string("") - Error - '""' is an empty string! + Condition + Error: + ! '""' is an empty string! --- Code assert_non_empty_string(123) - Error - '123' is not a string! (class is numeric, not character) + Condition + Error: + ! '123' is not a string! (class is numeric, not character) --- Code assert_non_empty_string(c(1, 2, 3)) - Error - 'c(1, 2, 3)' is not a string! (class is numeric, not character) + Condition + Error: + ! 'c(1, 2, 3)' is not a string! (class is numeric, not character) # assert_list() works [plain] Code assert_list(1) - Error - '1' must be a list, not a numeric + Condition + Error: + ! '1' must be a list, not a numeric --- Code assert_list(1.5) - Error - '1.5' must be a list, not a numeric + Condition + Error: + ! '1.5' must be a list, not a numeric --- Code assert_list("abc") - Error - '"abc"' must be a list, not a character + Condition + Error: + ! '"abc"' must be a list, not a character --- Code assert_list(c(1, 2, 3)) - Error - 'c(1, 2, 3)' must be a list, not a numeric + Condition + Error: + ! 'c(1, 2, 3)' must be a list, not a numeric --- Code assert_list(mtcars) - Error - 'mtcars' must be a list, not a data.frame + Condition + Error: + ! 'mtcars' must be a list, not a data.frame --- Code assert_list(factor(c(1, 2, 3))) - Error - 'factor(c(1, 2, 3))' must be a list, not a factor + Condition + Error: + ! 'factor(c(1, 2, 3))' must be a list, not a factor # assert_reactive() works [plain] Code assert_reactive(1) - Error - '1' must be a reactive, not a numeric + Condition + Error: + ! '1' must be a reactive, not a numeric --- Code assert_reactive(1.5) - Error - '1.5' must be a reactive, not a numeric + Condition + Error: + ! '1.5' must be a reactive, not a numeric --- Code assert_reactive("abc") - Error - '"abc"' must be a reactive, not a character + Condition + Error: + ! '"abc"' must be a reactive, not a character --- Code assert_reactive(c(1, 2, 3)) - Error - 'c(1, 2, 3)' must be a reactive, not a numeric + Condition + Error: + ! 'c(1, 2, 3)' must be a reactive, not a numeric --- Code assert_reactive(mtcars) - Error - 'mtcars' must be a reactive, not a data.frame + Condition + Error: + ! 'mtcars' must be a reactive, not a data.frame --- Code assert_reactive(factor(c(1, 2, 3))) - Error - 'factor(c(1, 2, 3))' must be a reactive, not a factor + Condition + Error: + ! 'factor(c(1, 2, 3))' must be a reactive, not a factor # assert_function() works [plain] Code assert_function(1) - Error - '1' must be a function, not a numeric + Condition + Error: + ! '1' must be a function, not a numeric --- Code assert_function("abc") - Error - '"abc"' must be a function, not a character + Condition + Error: + ! '"abc"' must be a function, not a character --- Code assert_function(c(1, 2, 3)) - Error - 'c(1, 2, 3)' must be a function, not a numeric + Condition + Error: + ! 'c(1, 2, 3)' must be a function, not a numeric diff --git a/tests/testthat/_snaps/has.md b/tests/testthat/_snaps/has.md index 467b6d1..5bb2a5e 100644 --- a/tests/testthat/_snaps/has.md +++ b/tests/testthat/_snaps/has.md @@ -2,34 +2,39 @@ Code assert_class(1, class = "character") - Error - '1' must belong to class 'character', not numeric + Condition + Error: + ! '1' must belong to class 'character', not numeric --- Code assert_class("abc", class = "numeric") - Error - '"abc"' must belong to class 'numeric', not character + Condition + Error: + ! '"abc"' must belong to class 'numeric', not character --- Code assert_class(mtcars, class = "list") - Error - 'mtcars' must belong to class 'list', not data.frame + Condition + Error: + ! 'mtcars' must belong to class 'list', not data.frame # assert_no_missing() works [plain] Code assert_no_missing(c(1, 2, NA)) - Error - 'c(1, 2, NA)' must have no missing values! Found 1 + Condition + Error: + ! 'c(1, 2, NA)' must have no missing values! Found 1 --- Code assert_no_missing(c("a", NA, "c")) - Error - 'c("a", NA, "c")' must have no missing values! Found 1 + Condition + Error: + ! 'c("a", NA, "c")' must have no missing values! Found 1