Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kalinowski committed Nov 6, 2024
1 parent 0ad14b6 commit f75e089
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/testthat/test-method-ops.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,13 @@ test_that("Ops methods can use super", {

expect_equal(foo2(1L) + 1, foo2(2L))
})


test_that("Unary Ops methods work", {
Double := new_class(class_double)
method(`-`, list(Double, class_missing)) <- function(e1, e2) {
Double(-as.double(e1))
}

expect_identical(-Double(1), Double(-1))
})

0 comments on commit f75e089

Please sign in to comment.