/usr/share/doc/r-cran-crayon/tests/testthat/test-has-style.r is in r-cran-crayon 1.3.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | context("Does a string have ANSI style?")
op <- options()
on.exit(options(op))
options(crayon.enabled = TRUE)
test_that("has_style works", {
expect_false(has_style("foobar"))
for (st in names(styles)) {
expect_true(has_style(style("foobar", st)))
}
})
context("Strip style from string")
test_that("strip_style works", {
expect_equal("", strip_style(""))
expect_equal("foobar", strip_style("foobar"))
expect_equal("foobar", strip_style(red$underline$bold("foobar")))
for (st in names(styles)) {
expect_equal("foobar", strip_style(style("foobar", st)))
}
})
|