context("test-utils") test_that("map_arg", { expect_equal(map_arg("a", "b", "c", .f = paste), list(a = "a b c")) expect_equal(map_arg("a", "b", "c", .f = paste, .args = list(sep = ",")), list(a = "a,b,c")) expect_equal(map_arg("a", "b", "c", .f = paste, .args = list(sep = ",", collapse = NULL)), list(a = "a,b,c")) }) test_that("compact", { expect_equal(compact(list(x = NULL, y = 1)), list(y = 1)) expect_equal(compact(list(x = list(NULL), y = 1)), list(x = list(NULL), y = 1)) expect_null(compact(list(x = NULL, y = NULL))) }) test_that("is_htmlish", { expect_true(is_html(htmltools::HTML("test"))) expect_true(is_tagList(htmltools::tagList("test"))) expect_true(is_tag(htmltools::tag("div", list("test")))) expect_true(is_htmlish(tag_p("test"))) })