Skip to content

Commit

Permalink
avoid snapshot for this test since it changes slightly across R versions
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Oct 23, 2024
1 parent bdd5a9f commit c2f994c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
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")
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

0 comments on commit c2f994c

Please sign in to comment.