File: test-boxes.R

package info (click to toggle)
r-cran-cli 3.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,288 kB
  • sloc: ansic: 16,412; cpp: 37; sh: 13; makefile: 2
file content (61 lines) | stat: -rw-r--r-- 1,918 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

test_that_cli(configs = c("plain", "unicode"), "empty label", {
  expect_snapshot(boxx(""))
})

test_that_cli(configs = c("plain", "unicode"), "empty label 2", {
  expect_snapshot(boxx(character()))
})

test_that_cli(configs = c("plain", "unicode"), "label", {
  expect_snapshot(boxx("label"))
})

test_that_cli(configs = c("plain", "unicode"), "label vector", {
  expect_snapshot(boxx(c("label", "l2")))
})

test_that_cli(configs = c("plain", "unicode"), "border style", {
  expect_snapshot(boxx("label", border_style = "classic"))
})

test_that_cli(configs = c("plain", "unicode"), "padding", {
  expect_snapshot(boxx("label", padding = 2))
  expect_snapshot(boxx("label", padding = c(1,2,1,2)))
  expect_snapshot(boxx("label", padding = c(1,2,0,2)))
  expect_snapshot(boxx("label", padding = c(1,2,0,0)))
})

test_that_cli(configs = c("plain", "unicode"), "margin", {
  expect_snapshot(boxx("label", margin = 1))
  expect_snapshot(boxx("label", margin = c(1,2,3,4)))
  expect_snapshot(boxx("label", margin = c(0,1,2,0)))
})

test_that_cli(configs = c("plain", "unicode"), "float", {
  expect_snapshot(boxx("label", float = "center", width = 20))
  expect_snapshot(boxx("label", float = "right", width = 20))
})

test_that_cli("background_col", {
  expect_snapshot(boxx("label", background_col = "red"))
  expect_snapshot(boxx("label", background_col = col_red))
})

test_that_cli("border_col", {
  expect_snapshot(boxx("label", border_col = "red"))
  expect_snapshot(boxx("label", border_col = col_red))
})

test_that_cli(configs = c("plain", "unicode"), "align", {
  expect_snapshot(boxx(c("label", "l2"), align = "center"))
  expect_snapshot(boxx(c("label", "l2"), align = "right"))
})

test_that_cli(configs = c("plain", "unicode"), "header", {
  expect_snapshot(boxx("foobar", header = "foo"))
})

test_that_cli(configs = c("plain", "unicode"), "footer", {
  expect_snapshot(boxx("foobar", footer = "foo"))
})