Skip to content

Commit

Permalink
Fix testthat snapshots and update rlang version (#1519)
Browse files Browse the repository at this point in the history
* Update minimum rlang version

* Update snapshots to latest rlang

* Use `check_required()` for `widths` too

In particular, to give consistent snapshots on old R versions
  • Loading branch information
DavisVaughan authored Sep 26, 2023
1 parent 0764e65 commit ad62841
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Imports:
lifecycle (>= 1.0.3),
magrittr,
purrr (>= 1.0.1),
rlang (>= 1.0.4),
rlang (>= 1.1.1),
stringr (>= 1.5.0),
tibble (>= 2.1.1),
tidyselect (>= 1.2.0),
Expand Down
1 change: 1 addition & 0 deletions R/separate-wider.R
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ separate_wider_position <- function(
check_installed("stringr")
check_data_frame(data)
check_required(cols)
check_required(widths)
if (!is_integerish(widths) || !any(have_name(widths))) {
cli::cli_abort("{.arg widths} must be a (partially) named integer vector.")
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/append.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
Error in `df_append()`:
! `after` must be a whole number, not the number 1.5.
i This is an internal error that was detected in the tidyr package.
Please report it at <https://github.com/tidyverse/tidyr/issues> with a reprex (<https://https://tidyverse.org/help/>) and the full backtrace.
Please report it at <https://github.com/tidyverse/tidyr/issues> with a reprex (<https://tidyverse.org/help/>) and the full backtrace.

2 changes: 1 addition & 1 deletion tests/testthat/_snaps/hoist.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
Output
<error/rlang_error>
Error in `hoist()`:
! `.data[[.col]]` must be a list, not a number.
! `.data[[.col]]` must be a list, not the number 1.
Code
(expect_error(df %>% hoist(x, 1)))
Output
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/_snaps/pivot-long.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
! Arguments in `...` must be used.
x Problematic argument:
* ..1 = 1
i Did you misspell an argument name?
Code
(expect_error(pivot_longer(df, c(x, y), col_vary = "slowest")))
Output
Expand All @@ -197,6 +198,7 @@
! Arguments in `...` must be used.
x Problematic argument:
* col_vary = "slowest"
i Did you misspell an argument name?

# `build_longer_spec()` requires empty dots

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/separate-wider.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
Code
df %>% separate_wider_position(x)
Condition
Error in `is_integerish()`:
! argument "widths" is missing, with no default
Error in `separate_wider_position()`:
! `widths` is absent but must be supplied.
Code
df %>% separate_wider_position(x, widths = 1.5)
Condition
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/unnest-helper.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
Output
<error/rlang_error>
Error:
! Can't convert `transform$x`, a number, to a function.
! Can't convert `transform$x`, a double vector, to a function.
Code
(expect_error(df_simplify(data.frame(), transform = list(x = 1, x = 1))))
Output
Expand Down

0 comments on commit ad62841

Please sign in to comment.