context("autotest-scan")
library(sf)
files <- get_files()
test_that("files are found", {
expect_that(files, is_a("character"))
expect_true(all(file.exists(files)))
})
finfo <- get_info(files)
test_that("we can get info on the files", {
finfo %>% expect_length(11L)
})
test_that("we can read a file", {
expect_message(try_read(finfo$fullname[1L]), basename(finfo$fullname[1L]))
})
test_that("we can read all files with segfault", {
for (i in seq_len(nrow(finfo))) {
expect_message(x <- try_read(finfo$fullname[1L]), basename(finfo$fullname[1L]))
if (!inherits(x, "try-error")) {
## need better than just print here
print(st_geometry(x))
print(tibble::as_tibble(x))
}
}
})
# ## just a small sample for now
# #ss <- sample(nrow(fi), 10L)
# # ss <- c(grep("shp$", fi$fullname), grep("geojson$", fi$fullname))
# ss <- c(23L, 266L, 383L, 389L, 429L, 513L)
# results <- lapply(fi$fullname[ss], try_read)
# #
# expect_that(results, is_a("list"))
# })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.