hoad
hoad copied to clipboard
find a better way to loop over entries in tests
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 😏.