Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Jan 29, 2022
1 parent 65f3e1d commit c373f23
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
84 changes: 84 additions & 0 deletions tests/testthat/_snaps/unicode/ctl_colonnade.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,88 @@
# more
# variable:
# b <chr>
Code
tbl_format_setup(x, width = 30, focus = c("a", "b"))
Output
<pillar_tbl_format_setup>
<tbl_format_header(setup)>
# A data frame: 1 × 2
<tbl_format_body(setup)>
a$x $y b
<dbl> <dbl> <chr> 
1 1 2 long enough
<tbl_format_footer(setup)>
Code
tbl_format_setup(x, width = 15, focus = c("a", "b"))
Output
<pillar_tbl_format_setup>
<tbl_format_header(setup)>
# A data
# frame: 1 ×
# 2
<tbl_format_body(setup)>
a$x b
<dbl> <chr> 
1 1 long e…
<tbl_format_footer(setup)>
Code
tbl_format_setup(x, width = 10, focus = c("a", "b"))
Output
<pillar_tbl_format_setup>
<tbl_format_header(setup)>
# A data
# frame:
# 1 × 2
<tbl_format_body(setup)>
a$x
<dbl>
1 1
<tbl_format_footer(setup)>
# … with
# 1
# more
# variable:
# b <chr>
Code
tbl_format_setup(x[2:1], width = 30, focus = c("a", "b"))
Output
<pillar_tbl_format_setup>
<tbl_format_header(setup)>
# A data frame: 1 × 2
<tbl_format_body(setup)>
b a$x $y
<chr>  <dbl> <dbl>
1 long enough 1 2
<tbl_format_footer(setup)>
Code
tbl_format_setup(x[2:1], width = 15, focus = c("a", "b"))
Output
<pillar_tbl_format_setup>
<tbl_format_header(setup)>
# A data
# frame: 1 ×
# 2
<tbl_format_body(setup)>
b a$x
<chr>  <dbl>
1 long e… 1
<tbl_format_footer(setup)>
Code
tbl_format_setup(x[2:1], width = 10, focus = c("a", "b"))
Output
<pillar_tbl_format_setup>
<tbl_format_header(setup)>
# A data
# frame:
# 1 × 2
<tbl_format_body(setup)>
b
<chr> 
1 long en…
<tbl_format_footer(setup)>
# … with
# 1
# more
# variable:
# a <tbl[,2]>

6 changes: 6 additions & 0 deletions tests/testthat/test-ctl_colonnade.R
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,11 @@ test_that("focus columns", {
tbl_format_setup(x[2:1], width = 30, focus = "a")
tbl_format_setup(x[2:1], width = 15, focus = "a")
tbl_format_setup(x[2:1], width = 10, focus = "a")
tbl_format_setup(x, width = 30, focus = c("a", "b"))
tbl_format_setup(x, width = 15, focus = c("a", "b"))
tbl_format_setup(x, width = 10, focus = c("a", "b"))
tbl_format_setup(x[2:1], width = 30, focus = c("a", "b"))
tbl_format_setup(x[2:1], width = 15, focus = c("a", "b"))
tbl_format_setup(x[2:1], width = 10, focus = c("a", "b"))
})
})

0 comments on commit c373f23

Please sign in to comment.