tests/testthat/test-gapminder.R

test_that("China imputation is not stupid", {
  ## https://github.com/jennybc/gapminder/issues/4
  tmp_file <- file.path(tempdir(), "gdat.dput")
  on.exit(unlink(tmp_file))
  dput(gapminder, tmp_file)
  gap2 <- dget(tmp_file)
  expect_identical(gapminder, gap2)
})

test_that("data objects are unchanged", {
  expect_snapshot_value(gapminder, style = "serialize")
  expect_snapshot_value(gapminder_unfiltered, style = "serialize")
  expect_snapshot_value(country_colors, style = "serialize")
  expect_snapshot_value(continent_colors, style = "serialize")
  expect_snapshot_value(country_codes, style = "serialize")
})

Try the gapminder package in your browser

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

gapminder documentation built on April 1, 2023, 12:24 a.m.