ropensci / charlatan

Create fake data in R

Home Page:https://docs.ropensci.org/charlatan/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Review the FIXME comments test-color.R

kylevoyto opened this issue · comments

There are 2 FIXME comments in the test-color.R file that might be appropriate to delete.

  1. I have been unable to reproduce the failure for the following test:
test_that("ColorProvider locale support works", {
  ## FIXME: sometimes this fails
  skip_on_cran()
  skip_on_travis()

  test_locale <- function(loc) {
    bb <- ColorProvider$new(locale = loc)

    expect_is(bb$locale, "character")
    expect_equal(bb$locale, loc)

    expect_is(bb$color_name(), "character")
    expect_true(all(bb$color_name() %in% names(bb$all_colors)))

    expect_is(bb$safe_color_name(), "character")
    expect_true(all(bb$safe_color_name() %in% bb$safe_colors))
  }

  locales <- c("en_US", "uk_UA")
  for (loc in locales) {
    test_locale(loc)
  }
})
  1. I don't see what an appropriate format would be for color and safe color names. The hex and rgb colors have formats that are testable. There are tests for color_name and safe_color_name that ensure they return character vectors that are the expected length. They also test that the names are pulled from the underlying all_colors and safe_colors vectors (part of the ColorProvider).
context("color and safe color matches expected format")

# FIXME - do these tests
# test_that("color_name matches expected format", {
#   "xxx"
# })
#
# test_that("safe_color_name matches expected format", {
#   "xxx"
# })

I think both of these comments should be deleted, but I'd like someone to review this suggestion.

agree that we should remove those