Skip to content

Commit

Permalink
Update internal uses of deprecated mocking functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Nov 4, 2024
1 parent 8c2bd6e commit f686b2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-examples.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_that("test_examples works with installed packages", {
local_edition(2)

local_mock(test_rd = identity)
local_mocked_bindings(test_rd = identity)
expect_true(length(test_examples()) > 1)
})

Expand Down
5 changes: 2 additions & 3 deletions tests/testthat/test-reporter-debug.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_that("produces consistent output", {
withr::local_options(testthat.edition_ignore = TRUE)
local_edition(2)
local_mock(
local_mocked_bindings(
show_menu = function(choices, title = NULL) {
cat(paste0(format(seq_along(choices)), ": ", choices, sep = "\n"), "\n", sep = "")
0L
Expand All @@ -22,7 +22,7 @@ get_frame_from_debug_reporter <- function(choice, fun, envir = parent.frame()) {
force(choice)
test_debug_reporter_parent_frame <- NULL

with_mock(
with_mocked_bindings(
show_menu = function(choices, title = NULL) {
# if (choice > 0) print(choices)
my_choice <- choice
Expand Down Expand Up @@ -178,4 +178,3 @@ test_that("browser() is called for the correct frame for skips", {
expect_equal(get_vars_from_debug_reporter(3, fun_3), "g")
expect_equal(get_vars_from_debug_reporter(4, fun_3), character())
})

0 comments on commit f686b2d

Please sign in to comment.