Skip to content

Commit

Permalink
use mocked bindings for test
Browse files Browse the repository at this point in the history
  • Loading branch information
TimTaylor authored and krlmlr committed Dec 19, 2023
1 parent 990d733 commit a36c56d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/testthat/test-as_tibble.R
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,9 @@ test_that("output test", {
test_that("as_tibble.data.frame coerces extended data.frames first", {
x <- structure(mtcars, extra = "extra", class = c("ext_df_", "data.frame"))
y <- as_tibble(head(mtcars))
fun <- function(x, row.names = NULL, optional = FALSE, ...) y
.S3method("as.data.frame", "ext_df_", fun)
expect_identical(as_tibble(x), y)
with_mocked_bindings(
as.data.frame = function(x, row.names = NULL, optional = FALSE, ...) y,
code = expect_identical(as_tibble(x), y),
.package = "base"
)
})

0 comments on commit a36c56d

Please sign in to comment.