Skip to content

Commit

Permalink
add tests for setting the generic '[' function
Browse files Browse the repository at this point in the history
  • Loading branch information
c-mertes committed Feb 11, 2024
1 parent 2e46996 commit 087935f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/testthat/test_getter_setter.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ test_that("counts", {
expect_equal(counts(fds, type="theta", side='other'),
N(fds, "theta") - K(fds, "theta"))
})

test_that("generic functions", {
# test that the correct functions are selected and called
methDef <- selectMethod("[", c("FraserDataSet", "ANY", "ANY", drop="ANY"))
expect_equal(slot(methDef, "defined")[["x"]], "FraserDataSet")
methDef <- selectMethod("[",
c("FraserDataSet", "ANY", "ANY", drop="missing"))
expect_equal(slot(methDef, "defined")[["x"]], "FraserDataSet")
})

0 comments on commit 087935f

Please sign in to comment.