diff --git a/tests/testthat/_snaps/adverb-auto-browse.md b/tests/testthat/_snaps/adverb-auto-browse.md index 3ca159c5..18381b53 100644 --- a/tests/testthat/_snaps/adverb-auto-browse.md +++ b/tests/testthat/_snaps/adverb-auto-browse.md @@ -6,10 +6,3 @@ Error in `auto_browse()`: ! `.f` must not be a primitive function. ---- - - Code - auto_browse(identity)(NULL) - Output - NULL - diff --git a/tests/testthat/_snaps/deprec-prepend.md b/tests/testthat/_snaps/deprec-prepend.md index 5d47cc8b..3889f7b5 100644 --- a/tests/testthat/_snaps/deprec-prepend.md +++ b/tests/testthat/_snaps/deprec-prepend.md @@ -7,3 +7,27 @@ `prepend()` was deprecated in purrr 1.0.0. i Please use append(after = 0) instead. +# prepend throws error if before param is neither NULL nor between 1 and length(x) + + Code + prepend(list(), 1, before = 1) + Condition + Error in `prepend()`: + ! is.null(before) || (before > 0 && before <= n) is not TRUE + +--- + + Code + x %>% prepend(4, before = 0) + Condition + Error in `prepend()`: + ! is.null(before) || (before > 0 && before <= n) is not TRUE + +--- + + Code + x %>% prepend(4, before = 4) + Condition + Error in `prepend()`: + ! is.null(before) || (before > 0 && before <= n) is not TRUE + diff --git a/tests/testthat/_snaps/deprec-utils.md b/tests/testthat/_snaps/deprec-utils.md index 89c181b0..7bef1395 100644 --- a/tests/testthat/_snaps/deprec-utils.md +++ b/tests/testthat/_snaps/deprec-utils.md @@ -11,3 +11,35 @@ Warning: `rbernoulli()` was deprecated in purrr 1.0.0. +# rdunif fails if a and b are not unit length numbers + + Code + rdunif(1000, 1, "a") + Condition + Error in `rdunif()`: + ! is.numeric(a) is not TRUE + +--- + + Code + rdunif(1000, 1, c(0.5, 0.2)) + Condition + Error in `rdunif()`: + ! length(a) == 1 is not TRUE + +--- + + Code + rdunif(1000, FALSE, 2) + Condition + Error in `rdunif()`: + ! is.numeric(b) is not TRUE + +--- + + Code + rdunif(1000, c(2, 3), 2) + Condition + Error in `rdunif()`: + ! length(b) == 1 is not TRUE + diff --git a/tests/testthat/_snaps/deprec-when.md b/tests/testthat/_snaps/deprec-when.md index 483dee03..c888c011 100644 --- a/tests/testthat/_snaps/deprec-when.md +++ b/tests/testthat/_snaps/deprec-when.md @@ -7,3 +7,11 @@ `when()` was deprecated in purrr 1.0.0. i Please use `if` instead. +# error when named arguments have no matching conditions + + Code + 1:5 %>% when(a = sum(.) < 5 ~ 3) + Condition + Error in `when()`: + ! At least one matching condition is needed. + diff --git a/tests/testthat/_snaps/every-some-none.md b/tests/testthat/_snaps/every-some-none.md new file mode 100644 index 00000000..0b3bb46d --- /dev/null +++ b/tests/testthat/_snaps/every-some-none.md @@ -0,0 +1,16 @@ +# every() requires logical value + + Code + every(list(1:3), identity) + Condition + Error in `every()`: + ! `.p()` must return a single `TRUE` or `FALSE`, not an integer vector. + +--- + + Code + every(list(function() NULL), identity) + Condition + Error in `every()`: + ! `.p()` must return a single `TRUE` or `FALSE`, not a function. + diff --git a/tests/testthat/_snaps/map-depth.md b/tests/testthat/_snaps/map-depth.md index cc1a3ad4..b0bb90a7 100644 --- a/tests/testthat/_snaps/map-depth.md +++ b/tests/testthat/_snaps/map-depth.md @@ -20,6 +20,16 @@ Error in `map_depth()`: ! Negative `.depth` (-5) must be greater than -4. +# default doesn't recurse into data frames, but can customise + + Code + map_depth(x, 2, class) + Condition + Error in `.fmap()`: + i In index: 1. + Caused by error in `map_depth()`: + ! List not deep enough + # modify_depth modifies values at specified depth Code @@ -42,6 +52,20 @@ Error in `modify_depth()`: ! Negative `.depth` (-5) must be greater than -4. +# vectorised operations on the recursive and atomic levels yield same results + + Code + modify_depth(x, 5, `+`, 10L) + Condition + Error in `map()`: + i In index: 1. + Caused by error in `map()`: + i In index: 1. + Caused by error in `map()`: + i In index: 1. + Caused by error in `modify_depth()`: + ! List not deep enough + # validates depth Code diff --git a/tests/testthat/_snaps/pluck.md b/tests/testthat/_snaps/pluck.md index 65a1aeb0..43b43f33 100644 --- a/tests/testthat/_snaps/pluck.md +++ b/tests/testthat/_snaps/pluck.md @@ -277,3 +277,19 @@ Error in `pluck_raw()`: ! Index 1 must have length 1, not 26. +# pluck() dispatches on vector methods + + Code + chuck(x, 1, 1) + Condition + Error in `chuck()`: + ! Length of S3 object must be a scalar integer. + +--- + + Code + chuck(x, 1, "b", 1) + Condition + Error in `chuck()`: + ! Index 2 is attempting to pluck from an unnamed vector using a string name. +