inst/tinytest/test_HTMLrm.R

test <- "before <a href='http://enricoschumann.net'>LINK</a>  after"

expect_equal(HTMLrm(test),
             "before http://enricoschumann.net  after")

expect_equal(HTMLrm(paste0(test, test)),
             paste(rep("before http://enricoschumann.net  after", 2),
                   collapse = ""))

## ---

test <- "before <a>LINK</a> after"
expect_equal(HTMLrm("before <a>LINK</a> after"),
             "before LINK after")

## ---

test <- "before <a target = '_blank' href='http://enricoschumann.net'>LINK</a> after"
expect_equal(HTMLrm(test),
             "before http://enricoschumann.net after")

## --- comments

test <- "before <!-- comment --> after"
expect_equal(HTMLrm(test),
             "before  after")

Try the textutils package in your browser

Any scripts or data that you put into this service are public.

textutils documentation built on May 29, 2024, 10:37 a.m.