Skip to content

Commit

Permalink
Restore lost snapshots?
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Aug 21, 2024
1 parent 5817933 commit 710c7e2
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 7 deletions.
7 changes: 0 additions & 7 deletions tests/testthat/_snaps/adverb-auto-browse.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,3 @@
Error in `auto_browse()`:
! `.f` must not be a primitive function.

---

Code
auto_browse(identity)(NULL)
Output
NULL

24 changes: 24 additions & 0 deletions tests/testthat/_snaps/deprec-prepend.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

32 changes: 32 additions & 0 deletions tests/testthat/_snaps/deprec-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

8 changes: 8 additions & 0 deletions tests/testthat/_snaps/deprec-when.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

16 changes: 16 additions & 0 deletions tests/testthat/_snaps/every-some-none.md
Original file line number Diff line number Diff line change
@@ -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.

24 changes: 24 additions & 0 deletions tests/testthat/_snaps/map-depth.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions tests/testthat/_snaps/pluck.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 710c7e2

Please sign in to comment.