tests/testthat/test-access_key.R

test_that("simple key access works", {
  expect_equal(
    read_by_key(dict_1, "language"),
    "Canadian English"
  )
})

test_that("compound keys are interpreted properly", {
  expect_equal(
    read_by_key(dict_1, "nouns.animals.dog"),
    "doggie"
  )
})

test_that("returns NULL if key not found", {
  expect_null(read_by_key(dict_1, "unavailable"))
  expect_null(read_by_key(dict_1, "truly.unavailable"))
})

Try the translated package in your browser

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

translated documentation built on April 25, 2023, 5:09 p.m.