Skip to content

Commit a834e08

Browse files
committed
fix: test with S4 method registration
1 parent 4858a08 commit a834e08

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/testthat/test-get_outputs.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@ testthat::describe("get_output", {
1919
testthat::expect_true(rlang::is_reference(get_outputs(q1)[[2]], q1$b))
2020
})
2121

22-
testthat::it("implicitly printed S4 object is returned asis in a list and identical to the one in the environment", {
22+
# it cannot have a package prefix here until upstream bug in testthat is solved
23+
it("implicitly printed S4 object is returned asis in a list and identical to the one in the environment", {
24+
methods::setClass("NewS4Class", slots = list(value = "numeric"))
25+
withr::defer(removeClass("NewS4Class"))
2326
q <- qenv()
2427
q1 <- eval_code(
2528
q,
2629
expression(
27-
methods::setClass("NewS4Class", slots = list(value = "numeric")),
2830
new_obj <- methods::new("NewS4Class", value = 42),
2931
new_obj
3032
)
3133
)
32-
withr::defer(removeClass("NewS4Class"))
3334
testthat::expect_identical(get_outputs(q1), unname(as.list(q1)))
3435
testthat::expect_true(rlang::is_reference(get_outputs(q1)[[1]], q1$new_obj))
3536
testthat::expect_s4_class(get_outputs(q1)[[1]], "NewS4Class")

0 commit comments

Comments
 (0)