hoad icon indicating copy to clipboard operation
hoad copied to clipboard

find a better way to loop over entries in tests

Open maxheld83 opened this issue 5 years ago • 0 comments

we have quite a lot of objects where we have to run tests row-wise, because we have a lot of (small-ish) data objects such as license_patterns in the package, which we'd ideally test on every commit via testthat.

I've just done this crudely, like so:

test_that("urls are valid", {
  purrr::walk(
    .x = license_patterns,
    .f = function(x) {
      expect_list(httr::parse_url(x))
    }
  )
})

This works, but is a bit verbose and doesn't produce pretty errors.

Not urgent right now, but we should improve this at some point, because these tests and errors are probably going to keep us pretty busy 😏.

maxheld83 avatar Jun 03 '20 20:06 maxheld83