Debian Codegraph @

tests/testthat/test-tbl-format-body.R

raw
1 test_that("tbl_format_body() results", {
2 expect_snapshot({
3 "Various column types"
4 tbl_format_body(tbl_format_setup(df_all, width = 30))
5
6 tbl_format_body(tbl_format_setup(df_all, width = 300))
7
8 "POSIXct and POSIXlt"
9 df <- new_tbl(list(x = as.POSIXct("2016-01-01 12:34:56 GMT") + 1:12))
10 df$y <- as.POSIXlt(df$x)
11
12 tbl_format_body(tbl_format_setup(df, width = 60L))
13
14 "Colonnade"
15 ctl_colonnade(list(a = 1:3), has_row_id = FALSE)
16
17 # For coverage tests
18 ctl_colonnade(list(a = 1:3))
19 })
20 })
21
22 test_that("body: output for wide characters", {
23 skip_if(!l10n_info()$`UTF-8`)
24
25 if (getRversion() == "4.0.4") {
26 # This seems to show differently on the Mac:
27 # writeLines(evaluate::evaluate('c("\\u6210", "\\u6210")')[[1]]$src)
28 skip_on_os("mac")
29 }
30
31 local_utf8()
32
33 expect_snapshot({
34 x <- c("\u6210\u4ea4\u65e5\u671f", "\u5408\u540c\u5f55\u5165\u65e5\u671f")
35 df <- new_tbl(setNames(list(1:3, 4:6), x))
36 print(df, n = 8L, width = 60L)
37 })
38 })