context("Test string replacement")
test_that("instances can be replaced",{
result <- rope:::string_replace_single("this is a string", "string", "turnip")
expect_that(result, equals("this is a turnip"))
})
test_that("instances can be replaced in multiple strings",{
result <- rope:::string_replace_vector(rep("this is a string",3), "string", "turnip")
expect_that(result, equals(rep("this is a turnip", 3)))
})
test_that("first instances can be replaced",{
result <- rope:::string_replace_first_single("this is a string string", "string", "turnip")
expect_that(result, equals("this is a turnip string"))
})
test_that("first instances can be replaced in multiple strings",{
result <- rope:::string_replace_first_vector(rep("this is a string string",3), "string", "turnip")
expect_that(result, equals(rep("this is a turnip string", 3)))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.