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 28 29 30 31 32 33
|
test_that("title ticks without width restriction", {
expect_equal(tick_if_needed("proper_title"), "proper_title")
expect_equal(tick_if_needed("needs ticks"), "`needs ticks`")
expect_equal(tick_if_needed("'ticks'"), "`'ticks'`")
expect_equal(tick_if_needed("embedded\nnewline"), "`embedded\\nnewline`")
})
test_that("title ticks and width with footnote", {
skip_if(!cli::is_utf8_output())
expect_snapshot({
format_title("proper_title", 15)
format_title("proper_title", 12)
format_title("proper_title", 10)
format_title("`a b`", 6)
format_title("`a b`", 5)
format_title("`a b`", 4)
format_title("`a b`", 3)
})
})
test_that("title ticks and width", {
expect_snapshot({
format_title("proper_title", 15, footnote = FALSE)
format_title("proper_title", 12, footnote = FALSE)
format_title("proper_title", 10, footnote = FALSE)
format_title("`a b`", 6, footnote = FALSE)
format_title("`a b`", 5, footnote = FALSE)
format_title("`a b`", 4, footnote = FALSE)
format_title("`a b`", 3, footnote = FALSE)
format_title("`a b`", 3, footnote = FALSE)
})
})
|