Skip to content

Commit

Permalink
We only need to suggest methods, not import it (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley authored Jun 18, 2024
1 parent 00fd317 commit 3ff4bcd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ URL: https://evaluate.r-lib.org/, https://github.com/r-lib/evaluate
BugReports: https://github.com/r-lib/evaluate/issues
Depends:
R (>= 4.0.0)
Imports:
methods
Suggests:
covr,
ggplot2 (>= 3.3.6),
lattice,
methods,
rlang,
testthat (>= 3.0.0),
withr
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-evaluate.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ test_that("terminal newline not needed", {
})

test_that("S4 methods are displayed with show, not print", {
setClass("A", contains = "function", where = environment())
setMethod("show", "A", function(object) cat("B"))
a <- new('A', function() b)
methods::setClass("A", contains = "function", where = environment())
methods::setMethod("show", "A", function(object) cat("B"))
a <- methods::new('A', function() b)

ev <- evaluate("a")
expect_equal(ev[[2]], "B")
})

test_that("errors during printing visible values are captured", {
setClass("A", contains = "function", where = environment())
setMethod("show", "A", function(object) stop("B"))
a <- new('A', function() b)
methods::setClass("A", contains = "function", where = environment())
methods::setMethod("show", "A", function(object) stop("B"))
a <- methods::new('A', function() b)

ev <- evaluate("a")
expect_output_types(ev, c("source", "error"))
Expand Down

0 comments on commit 3ff4bcd

Please sign in to comment.