test-skipDuplicateProducts.R 570 B

12345678910111213141516171819
  1. context("behavior of product pattern matching")
  2. opt <- options("warn")[[1]]
  3. options("warn" = 0)
  4. on.exit(options("warn" = opt))
  5. test_that("product selection wo/pattern matching skips derivatives", {
  6. out1 = expect_warning(skipDuplicateProducts("MOD17A2"))
  7. expect_match(out1, "\\^MOD17A2\\$")
  8. })
  9. test_that("product selection w/pattern matching includes derivatives", {
  10. out2 = skipDuplicateProducts("MOD17A2*")
  11. expect_match(out2, "MOD17A2\\*")
  12. lns = capture.output(getProduct(out2))
  13. expect_equal(length(lns), length(grep(out2, MODIS_Products$PRODUCT)))
  14. })