tests/testthat/test-keycap.R

library(testthat)

test_that("keycap works", {

  expect_equal(
    keycap(1),
    emoji("keycap_1")
  )

  expect_equal(
    keycap("#"),
    emoji("keycap_hash")
  )

  expect_equal(
    keycap("*"),
    emoji("keycap_star")
  )

  expect_equal(
    keycap(0:10),
    vapply(paste0("keycap_", 0:10), emoji,
           FUN.VALUE = character(1), USE.NAMES = FALSE)
  )

  expect_equal(
    keycap(c(1, 15)),
    c(emoji("keycap_1"), NA)
  )
})

Try the emoji package in your browser

Any scripts or data that you put into this service are public.

emoji documentation built on Oct. 30, 2024, 9:28 a.m.