tests/testthat/test-utils.R

test_that("oe_clean removes all files in download_directory", {
  withr::defer(oe_clean(tempdir()))

  file.copy(
    from = system.file("its-example.osm.pbf", package = "osmextract"),
    to = file.path(tempdir(), "test_its-example.osm.pbf")
  )

  oe_clean(tempdir())

  expect_equal(
    object = list.files(tempdir(), "\\.(pbf|gpkg)$", full.names = TRUE),
    expected = character(0)
  )
})

Try the osmextract package in your browser

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

osmextract documentation built on May 29, 2024, 6:48 a.m.