context("Checking rm_email")
test_that("rm_email is removing/replacing email strings",{
x <- paste("fred is fred@foo.com and joe is joe@example.com - but @this is a
twitter handle for twit@here.com or foo+bar@google.com/fred@foo.fnord")
x2 <- "fred is and joe is - but @this is a twitter handle for or /"
x3 <- "fred is fred@foo.com and joe is joe@example.com - but @this is a twitter handle for twit@here.com or foo+bar@google.com/fred@foo.fnord"
expect_equivalent(rm_email(x), x2)
expect_equivalent(rm_email(x, replacement = '\\1'), x3)
})
test_that("rm_email is extracting email strings",{
x <- paste("fred is fred@foo.com and joe is joe@example.com - but @this is a
twitter handle for twit@here.com or foo+bar@google.com/fred@foo.fnord")
x4 <- list(c("fred@foo.com", "joe@example.com", "twit@here.com", "foo+bar@google.com",
"fred@foo.fnord"))
expect_equivalent(rm_email(x, extract=TRUE), x4)
})