Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update standalone files + standardize snapshot tests #1579

Merged
merged 11 commits into from
Oct 25, 2024
7 changes: 1 addition & 6 deletions tests/testthat/_snaps/gather.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@

# gather throws error for weird objects

Code
gather(d, key, val, -x)
Condition <simpleError>
Error:
! object 'd' not found
Code
gather(df, key, val, -y)
Condition <simpleError>
Condition
Error:
! All columns be atomic vectors or lists (not expression)

Expand Down
10 changes: 4 additions & 6 deletions tests/testthat/test-gather.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,11 @@ test_that("gather throws error for weird objects", {
df <- data.frame(y = 1)
df$x <- expression(x)

expect_snapshot(error = TRUE, cnd_class = TRUE, {
gather(d, key, val, -x)
# Can't use snapshot, it changes between versions of R
expect_error(gather(d, key, val, -x), "not found")
olivroy marked this conversation as resolved.
Show resolved Hide resolved
expect_snapshot(error = TRUE, {
gather(df, key, val, -y)
},
# Failing for old versions of R. (<4.3)
transform = function(x) gsub(" in `gather()`", "", x)
)
})

e <- new.env(parent = emptyenv())
e$x <- 1
Expand Down
Loading