tests/testthat/test-glob.R

test_that("glob() works", {
  x <- c("apple", "banana", "peach", "pear", "orange")
  obj <- glob(x, "*e")
  exp <- c("apple", "orange")
  expect_identical(obj, exp)

  obj <- glob(x, "pea*", value = FALSE)
  exp <- c(3L, 4L)
  expect_identical(obj, exp)

  obj <- glob(x, "*an*", value = NA)
  exp <- c(FALSE, TRUE, FALSE, FALSE, TRUE)
  expect_identical(obj, exp)
})

Try the mark package in your browser

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

mark documentation built on May 29, 2024, 5:13 a.m.