tests/testthat/test-hijack.R

context("Checking hijack")

test_that("hijack is taking over formals",{

    mean2 <- function(x, na.rm = FALSE, ...){
        mean(x, ..., na.rm = na.rm)
    }
    expect_true(is.na((mean2(c(NA, 1:10)))))
    mean3 <- hijack(mean2, na.rm=TRUE)
    expect_false(is.na((mean3(c(NA, 1:10)))))
    
})
trinker/discon documentation built on May 31, 2019, 8:42 p.m.