Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

23 lines
806B

  1. context("test-utils")
  2. test_that("map_arg", {
  3. expect_equal(map_arg("a", "b", "c", .f = paste), list(a = "a b c"))
  4. expect_equal(map_arg("a", "b", "c", .f = paste, .args = list(sep = ",")),
  5. list(a = "a,b,c"))
  6. expect_equal(map_arg("a", "b", "c", .f = paste, .args = list(sep = ",", collapse = NULL)),
  7. list(a = "a,b,c"))
  8. })
  9. test_that("compact", {
  10. expect_equal(compact(list(x = NULL, y = 1)), list(y = 1))
  11. expect_equal(compact(list(x = list(NULL), y = 1)), list(x = list(NULL), y = 1))
  12. expect_null(compact(list(x = NULL, y = NULL)))
  13. })
  14. test_that("is_htmlish", {
  15. expect_true(is_html(htmltools::HTML("test")))
  16. expect_true(is_tagList(htmltools::tagList("test")))
  17. expect_true(is_tag(htmltools::tag("div", list("test"))))
  18. expect_true(is_htmlish(tag_p("test")))
  19. })