tests/testthat/test-bmatch.R

context("bmatch")


test_that("bmatch", {
  expect_equal(bmatch(c("hej", "pa", "dig"), "hej"), c(TRUE, FALSE, FALSE))
  expect_error(bmatch(c("hej", "pa", "dig"), "hejsan"), 
    "No match. Choose one of")
  expect_equal(bmatch(names(iris), NULL), !logical(5))
  expect_equal(bmatch("hejapabanan", "aba"), TRUE)
  expect_equal(bmatch("1 lazy 2", "lasy"), TRUE)
  expect_equal(bmatch("foo", c("foobar", "foo")), c(FALSE, TRUE))
})

Try the incadata package in your browser

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

incadata documentation built on April 14, 2020, 6:08 p.m.