tests/testthat/test-misc_paste2.R

test_that(".paste2 works", {

  expect_identical(
    object = .paste2(c("first", "second", "third")),
    expected = "first, second and third"
  )

  expect_identical(
    object = .paste2(c("first", "second", "third"), last = " or "),
    expected = "first, second or third"
  )
  expect_identical(
    object = .paste2(c("first", "second", "third"), sep = " + "),
    expected = "first + second and third"
  )
  expect_identical(
    object = .paste2(c("first", "second", "third"), quote = "`"),
    expected = "`first`, `second` and `third`"
  )
  expect_identical(
    object = .paste2(c("first", "second", "third"), quote_all = "`"),
    expected = "`first, second and third`"
  )

  expect_identical(
    object = .paste2(
      c("first", "second", "third"),
      last = " or ",
      sep = " + ",
      quote = "-",
      quote_all = "_"
    ),
    expected = "_-first- + -second- or -third-_"
  )

})

Try the rbioapi package in your browser

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

rbioapi documentation built on April 4, 2025, 5:04 a.m.