packrat/lib/x86_64-w64-mingw32/3.4.3/stringr/tests/testthat/test-join.r

context("Joining strings")

test_that("basic case works", {
  test <- c("a", "b", "c")

  expect_equal(str_c(test), test)
  expect_equal(str_c(test, sep = " "), test)
  expect_equal(str_c(test, collapse = ""), "abc")
})

test_that("NULLs are dropped", {
  test <- letters[1:3]

  expect_equal(str_c(test, NULL), test)
  expect_equal(str_c(test, NULL, "a", sep = " "), c("a a", "b a", "c a"))
})
UBC-MDS/Karl documentation built on May 22, 2019, 1:53 p.m.