test_that("output is a proper character", {
expect_type(path("C:", "dir"), "character")
})
test_that("error is returned if atoms are of unequal lengths", {
expect_error(path(c("C:", "D:"), "home"), "equal lengths")
})
test_that("function can be used either with c(atoms) or list(atoms)", {
expect_identical(
object = path(c("C:", "home"), c("user", "file.ext")),
expected = c("C:/user", "home/file.ext"))
expect_identical(
object = path(list("C:", "home"), list("user", "file.ext")),
expected = c("C:/user", "home/file.ext"))
})
test_that("encoding is UTF-8 if output contains special characters", {
expect_identical(Encoding(path("C:", "+$!É<Aÿ", "weird")), "UTF-8")
})
test_that("encoding is unknown if output only contains ASCII characters", {
expect_identical(Encoding(path("C:", "haha", "weird", "docs")), "unknown")
})
test_that("output length corresponds to input length", {
expect_length(path(list("C:", "home"), list("user", "file.ext")), 2L)
expect_length(path(list("C:", "dir1", "dir2"),
list("user", "dir3", "dir4")), 3L)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.