tests/testthat/test-shape.R

library(testthat)

test_that("shape works", {

  expect_equal(
    shape("green", "heart"),
    emoji_name[["green_heart"]]
  )

  expect_equal(
    shape("green", c("heart", "square", "heart")),
    unname(emoji_name[c("green_heart", "green_square", "green_heart")])
  )

  expect_equal(
    shape(c("yellow", "red", "orange"), c("heart", "square", "heart")),
    unname(emoji_name[c("yellow_heart", "red_square", "orange_heart")])
  )

  expect_equal(
    shape(c("white", "black"), "square"),
    unname(emoji_name[c("white_large_square", "black_large_square")])
  )

  expect_equal(
    shape("green", c("heart", "square", "nothing")),
    c(unname(emoji_name[c("green_heart", "green_square")]), 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.