Debian Codegraph @

tests/testthat/test-ticks.R

raw
1 test_that("title ticks without width restriction", {
2 expect_equal(tick_if_needed("proper_title"), "proper_title")
3 expect_equal(tick_if_needed("needs ticks"), "`needs ticks`")
4 expect_equal(tick_if_needed("'ticks'"), "`'ticks'`")
5 expect_equal(tick_if_needed("embedded\nnewline"), "`embedded\\nnewline`")
6 })
7
8 test_that("title ticks and width with footnote", {
9 skip_if(!cli::is_utf8_output())
10
11 expect_snapshot({
12 format_title("proper_title", 15)
13 format_title("proper_title", 12)
14 format_title("proper_title", 10)
15 format_title("`a b`", 6)
16 format_title("`a b`", 5)
17 format_title("`a b`", 4)
18 format_title("`a b`", 3)
19 })
20 })
21
22 test_that("title ticks and width", {
23 expect_snapshot({
24 format_title("proper_title", 15, footnote = FALSE)
25 format_title("proper_title", 12, footnote = FALSE)
26 format_title("proper_title", 10, footnote = FALSE)
27 format_title("`a b`", 6, footnote = FALSE)
28 format_title("`a b`", 5, footnote = FALSE)
29 format_title("`a b`", 4, footnote = FALSE)
30 format_title("`a b`", 3, footnote = FALSE)
31 format_title("`a b`", 3, footnote = FALSE)
32 })
33 })