tests/testthat/test-flag.R

library(testthat)

test_that("flag works", {

  expect_equal(
    flag("denmark"),
    emoji_name[["flag_Denmark"]]
  )

  expect_equal(
    flag(c("Denmark", "Vietnam")),
    unname(emoji_name[c("flag_Denmark", "flag_Vietnam")])
  )

  expect_equal(
    flag(c("Denmark", "nothing")),
    c(emoji_name[["flag_Denmark"]], NA)
  )

  expect_equal(
    flag("US Virgin Islands"),
    flag("U.S. Virgin Islands")
  )

  expect_equal(
    flag("US Virgin Islands"),
    flag("u.s. virgin islands")
  )

  expect_error(flag("nothing"))
})

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.