Skip to content

Commit 21023cb

Browse files
committed
Switch to a non snapshot based test
1 parent 29dab94 commit 21023cb

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

tests/testthat/_snaps/across.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -295,19 +295,6 @@
295295
Caused by error:
296296
! Can't subset `.data` outside of a data mask context.
297297

298-
# expand_if_across() expands lambdas
299-
300-
Code
301-
quo_squash(expand_if_across(quo))
302-
Output
303-
{
304-
x <- list(cyl = cyl > 4, am = am > 4)
305-
ns <- asNamespace("dplyr")
306-
size <- ns[["dplyr_list_size_common"]](x, absent = 1L, call = call("if_any"))
307-
x <- ns[["dplyr_list_recycle_common"]](x, size = size, call = call("if_any"))
308-
ns[["dplyr_list_pany"]](x, size = size, error_call = call("if_any"))
309-
}
310-
311298
# `across()` recycle `.fns` results to common size
312299

313300
Code

tests/testthat/test-across.R

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,9 +1246,17 @@ test_that("expand_if_across() expands lambdas", {
12461246
by <- compute_by(by = NULL, data = mtcars, error_call = call("caller"))
12471247
DataMask$new(mtcars, by, "mutate", call("caller"))
12481248

1249-
expect_snapshot({
1250-
quo_squash(expand_if_across(quo))
1251-
})
1249+
quo <- expand_if_across(quo)
1250+
1251+
# We just need to look for something we know we insert into the expression.
1252+
# `expect_snapshot()` doesn't seem to play nicely with covr on CI here, the
1253+
# expression captured seems to contain `covr:::count()` calls.
1254+
expect_true(
1255+
grepl(
1256+
"asNamespace",
1257+
paste0(expr_deparse(quo_squash(quo)), collapse = " ")
1258+
)
1259+
)
12521260
})
12531261

12541262
test_that("rowwise() preserves list-cols iff no `.fns` (#5951, #6264)", {

0 commit comments

Comments
 (0)