tests/testthat/test-emoji.R

library(testthat)
library(emoji)

test_that("Both aliases work with emoji()", {
  aliases <- emojis$aliases[[1]]

  expect_identical(
    emoji(aliases[1]),
    emoji(aliases[2])
  )
})

test_that("emoji() is lax with spaces, underscores, dashes and cases", {
  exp <- emoji("racing car")

  expect_identical(emoji("racing_car"), exp)
  expect_identical(emoji("racing-car"), exp)
  expect_identical(emoji("racing  car"), exp)
  expect_identical(emoji("racing--car"), exp)
  expect_identical(emoji("racing - car"), exp)
  expect_identical(emoji("racing  CAR"), exp)
})

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.