context("Test string removal")
test_that("single instances can be removed",{
result <- rope:::string_remove_single("this is a string", "string")
expect_that(result, equals("this is a "))
})
test_that("multiple instances can be removed",{
result <- rope:::string_remove_single("this is a stringstring", "string")
expect_that(result, equals("this is a "))
})
test_that("single instances can be removed from multiple strings",{
result <- rope:::string_remove_vector(rep("this is a string",2), "string")
expect_that(result, equals(rep("this is a ", 2)))
})
test_that("multiple instances can be removed from multiple strings",{
result <- rope:::string_remove_vector(rep("this is a stringstring",2), "string")
expect_that(result, equals(rep("this is a ", 2)))
})
test_that("first instances can be removed",{
result <- rope:::string_remove_first_single("this is a stringstring", "string")
expect_that(result, equals("this is a string"))
})
test_that("first instances can be removed from multiple strings",{
result <- rope:::string_remove_first_vector(rep("this is a stringstring",2), "string")
expect_that(result, equals(rep("this is a string", 2)))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.