tests/testthat/test-utils.R

test_that("class modifiers work", {
    expect_true(
        list() %>%
            add_class("hello") %>%
            inherits("hello")
    )
    expect_true(
        list() %>%
            add_class("hello") %>%
            rmv_class("hello") %>%
            { !inherits(., "hello") }
    )
})

test_that("drop_nulls work", {
    expect_length(
        list(NULL, "a", NULL, "b") %>%
            drop_nulls(),
        2L
    )
})
tjpalanca/tjutils documentation built on Jan. 20, 2021, 2:01 p.m.