tests/testthat/test-prep_pmap.R

test_that("prep_pmap works", {
  skip_on_cran() # deprecated
  df <- data.frame(
    x = c("apple", "banana", "cherry"),
    pattern = c("p", "n", "h"),
    replacement = c("P", "N", "H"),
    stringsAsFactors = FALSE
  )
  expect_equal(
    prep_pmap(df, gsub),
    list(
      "aPPle",
      "baNaNa",
      "cHerry"
    )
  )
  expect_error(
    prep_pmap(df, 42),
    regexp = "Argument .+\\.f.+ should be a function.",
    perl = TRUE
  )
})

Try the dataquieR package in your browser

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

dataquieR documentation built on July 26, 2023, 6:10 p.m.