context("Duplicating strings")
test_that("basic duplication works", {
expect_equal(str_dup("a", 3), "aaa")
expect_equal(str_dup("abc", 2), "abcabc")
expect_equal(str_dup(c("a", "b"), 2), c("aa", "bb"))
expect_equal(str_dup(c("a", "b"), c(2, 3)), c("aa", "bbb"))
})
test_that("0 duplicates equals empty string", {
expect_equal(str_dup("a", 0), "")
expect_equal(str_dup(c("a", "b"), 0), rep("", 2))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.