tests/testthat/test_removal.R

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)))
})
PeteHaitch/rope documentation built on May 8, 2019, 1:32 a.m.