context("Test the commify() function")
test_that("List of strings is correct", {
expect_error(commify())
expect_error(commify(1))
expect_error(commify(c(1, 2)))
expect_error(commify(c("a", "b"), 1))
expect_equal(commify(c("a", "b", "c"), use_and = TRUE), "a, b, and c")
expect_equal(commify(c("a", "b", "c"), use_and = FALSE), "a, b, c")
expect_equal(commify(c("a", "b")), "a and b")
expect_equal(commify(c("a", "b"), use_and = FALSE), "a and b")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.