diff --git a/R/compat-purrr.R b/R/compat-purrr.R index efb9a9ca3..810d7f4f5 100644 --- a/R/compat-purrr.R +++ b/R/compat-purrr.R @@ -138,13 +138,17 @@ transpose <- function(.l) { every <- function(.x, .p, ...) { for (i in seq_along(.x)) { - if (!rlang::is_true(.p(.x[[i]], ...))) return(FALSE) + if (!rlang::is_true(.p(.x[[i]], ...))) { + return(FALSE) + } } TRUE } some <- function(.x, .p, ...) { for (i in seq_along(.x)) { - if (rlang::is_true(.p(.x[[i]], ...))) return(TRUE) + if (rlang::is_true(.p(.x[[i]], ...))) { + return(TRUE) + } } FALSE } diff --git a/R/ctl_pillar.R b/R/ctl_pillar.R index 9a1808f6b..ede22da1f 100644 --- a/R/ctl_pillar.R +++ b/R/ctl_pillar.R @@ -25,7 +25,7 @@ #' @param ... Passed on to [pillar_shaft()]. #' @export #' @examples -#' x <- 123456789 * (10 ^ c(-1, -3, -5, NA, -8, -10)) +#' x <- 123456789 * (10^c(-1, -3, -5, NA, -8, -10)) #' pillar(x) #' pillar(-x) #' pillar(runif(10)) diff --git a/R/multi.R b/R/multi.R index 042c8dae4..4d13d0531 100644 --- a/R/multi.R +++ b/R/multi.R @@ -52,7 +52,7 @@ flatten_colonnade <- function(x) { vctrs::vec_rbind( !!!out, - #.ptype = vctrs::data_frame(names = list(), data = list()) + # .ptype = vctrs::data_frame(names = list(), data = list()) .ptype = vctrs::data_frame(names = character(), data = list()) ) } @@ -68,7 +68,7 @@ flatten_column <- function(x, name) { flatten_matrix_column(x, name) } else { # Length-one list, will be unlist()ed afterwards - #vctrs::data_frame(names = list(name), data = list(x)) + # vctrs::data_frame(names = list(name), data = list(x)) vctrs::data_frame(names = name, data = list(x)) } } @@ -79,7 +79,7 @@ flatten_df_column <- function(x, name) { vctrs::data_frame(names = name, data = list(new_empty_col_sentinel(x))) } else { x <- flatten_colonnade(unclass(x)) - #x$names <- map(x$names, function(.x) c(name, .x)) + # x$names <- map(x$names, function(.x) c(name, .x)) x$names <- paste0("$", x$names) x$names[[1]] <- paste0(name, x$names[[1]]) x @@ -89,12 +89,12 @@ flatten_df_column <- function(x, name) { flatten_matrix_column <- function(x, name) { if (ncol(x) == 0) { vctrs::data_frame( - #names = list(c(name, "[,0]")), + # names = list(c(name, "[,0]")), names = name, data = list(new_empty_col_sentinel(x)) ) } else { - x_list <- map(seq_len(ncol(x)), function(i) x[,i]) + x_list <- map(seq_len(ncol(x)), function(i) x[, i]) idx <- colnames(x) if (is.null(idx)) { @@ -103,7 +103,7 @@ flatten_matrix_column <- function(x, name) { idx <- encodeString(idx, quote = '"') } - #names <- map(idx, function(.x) c(name, .x)) + # names <- map(idx, function(.x) c(name, .x)) names <- paste0("[,", idx, "]") names[[1]] <- paste0(name, names[[1]]) @@ -365,13 +365,17 @@ colonnade_compute_tiered_col_widths_df <- function(col_df, tier_widths, fixed_ti #' `option(tibble.width = Inf)` or narrow colonnade). max_fit <- distribute_pillars(col_df$max_widths, tier_widths) #' If yes, this is the resulting fit, no more work needs to be done. - if (all_pillars_fit(max_fit)) return(max_fit) + if (all_pillars_fit(max_fit)) { + return(max_fit) + } #' Otherwise, if the maximum width is too wide, the same test #' is carried out with the minimum width. #' If this is still too wide, this is the resulting fit. min_fit <- distribute_pillars(col_df$min_widths, tier_widths) - if (!all_pillars_fit(min_fit)) return(min_fit) + if (!all_pillars_fit(min_fit)) { + return(min_fit) + } #' Otherwise, some tiers from the start #' will contain pillars with their maximum width, and the remaining tiers @@ -475,11 +479,15 @@ colonnade_distribute_space_df <- function(col_widths_df, tier_widths) { #' @usage NULL #' @aliases NULL colonnade_distribute_space <- function(col_widths, max_widths, width) { - if (any(is.na(col_widths))) return(col_widths) + if (any(is.na(col_widths))) { + return(col_widths) + } missing_space <- max_widths - col_widths # Shortcut to avoid division by zero - if (all(missing_space == 0L)) return(rep_along(col_widths, 0L)) + if (all(missing_space == 0L)) { + return(rep_along(col_widths, 0L)) + } #' @details #' The remaining space is distributed from left to right. diff --git a/R/scientific.R b/R/scientific.R index 313ea9756..cb832a831 100644 --- a/R/scientific.R +++ b/R/scientific.R @@ -19,7 +19,9 @@ supernum <- function(x) { stopifnot(is.integer(x)) num <- !is.na(x) - if (!any(num)) return(rep_along(x, "")) + if (!any(num)) { + return(rep_along(x, "")) + } neg <- num & x < 0 if (any(neg)) { diff --git a/R/shaft-.R b/R/shaft-.R index 27dcc2e7f..1f4a6f5d6 100644 --- a/R/shaft-.R +++ b/R/shaft-.R @@ -234,7 +234,8 @@ pillar_shaft.pillar_vertical <- function(x, ..., min_width = NULL, na_indent = 0 width <- get_max_extent(x) new_pillar_shaft_simple( - x, width = width, align = "left", min_width = min(width, min_width), + x, + width = width, align = "left", min_width = min(width, min_width), na = pillar_na(use_brackets_if_no_color = TRUE), na_indent = na_indent ) diff --git a/R/sigfig.R b/R/sigfig.R index 69063a080..b19844550 100644 --- a/R/sigfig.R +++ b/R/sigfig.R @@ -84,7 +84,9 @@ get_decimal_width <- function(x) { } safe_signif <- function(x, digits) { - if (length(x) == 0L) return(numeric()) + if (length(x) == 0L) { + return(numeric()) + } signif(x, digits) } @@ -274,7 +276,9 @@ assemble_decimal <- function(x) { #' @export format.pillar_shaft_decimal <- function(x, width, ...) { - if (length(x$dec$num) == 0L) return(character()) + if (length(x$dec$num) == 0L) { + return(character()) + } if (width < get_min_width(x)) { stop( diff --git a/R/tbl-format.R b/R/tbl-format.R index 9df3e3d5f..e4b769ae0 100644 --- a/R/tbl-format.R +++ b/R/tbl-format.R @@ -47,7 +47,8 @@ print.tbl <- function(x, width = NULL, ..., n = NULL, n_extra = NULL) { format.tbl <- function(x, width = NULL, ..., n = NULL, n_extra = NULL) { check_dots_empty(action = signal) - setup <- tbl_format_setup(x, width = width, ..., + setup <- tbl_format_setup(x, + width = width, ..., n = n, max_extra_cols = n_extra ) @@ -59,7 +60,9 @@ format.tbl <- function(x, width = NULL, ..., n = NULL, n_extra = NULL) { } format_comment <- function(x, width) { - if (length(x) == 0L) return(character()) + if (length(x) == 0L) { + return(character()) + } map_chr(x, wrap, prefix = "# ", width = min(width, cli::console_width())) } diff --git a/R/testthat.R b/R/testthat.R index d405790ff..206f6083b 100644 --- a/R/testthat.R +++ b/R/testthat.R @@ -35,14 +35,12 @@ #' # Good: Use tidyeval to defer construction #' pillar_quo <- rlang::quo(pillar(1:3)) #' expect_known_display(!!pillar_quo, file, crayon = FALSE) -#' #' \dontrun{ #' # Bad: Options set in the active session may affect the display #' integer_pillar <- pillar(1:3) #' expect_known_display(integer_pillar, file, crayon = FALSE) #' } expect_known_display <- function(object, file, ..., width = 80L, crayon = TRUE) { - object <- enquo(object) if (crayon) { diff --git a/R/title.R b/R/title.R index 162800e1b..6096986c4 100644 --- a/R/title.R +++ b/R/title.R @@ -38,18 +38,24 @@ get_min_title_width <- function(width) { stop("Option pillar.min_title_chars must be a nonnegative number", call. = FALSE) } - if (is.infinite(title_chars)) return(width) + if (is.infinite(title_chars)) { + return(width) + } # We don't use the ellipsis if we don't truncate, a solution with min() # is difficult to make work in all corner cases (and slower too) - if (width <= title_chars) return(width) + if (width <= title_chars) { + return(width) + } title_chars + get_extent(get_ellipsis()) } #' @export format.pillar_title <- function(x, width = NULL, ...) { title <- x[[1]] - if (is.null(title)) return(character()) + if (is.null(title)) { + return(character()) + } if (is.null(width)) { width <- get_width(x) diff --git a/R/type-sum.R b/R/type-sum.R index b86b0954d..8b6aa1c20 100644 --- a/R/type-sum.R +++ b/R/type-sum.R @@ -26,7 +26,9 @@ type_sum.factor <- function(x) { #' @export type_sum.default <- function(x) { - if (is.object(x) || vctrs::vec_is(x)) return(vctrs::vec_ptype_abbr(x)) + if (is.object(x) || vctrs::vec_is(x)) { + return(vctrs::vec_ptype_abbr(x)) + } switch(typeof(x), builtin = , @@ -97,7 +99,9 @@ size_sum <- function(x) { #' @export size_sum.default <- function(x) { - if (!vctrs::vec_is(x)) return("") + if (!vctrs::vec_is(x)) { + return("") + } paste0("[", dim_desc(x), "]") } diff --git a/R/utils.R b/R/utils.R index e42c96316..6411ecbd2 100644 --- a/R/utils.R +++ b/R/utils.R @@ -5,7 +5,9 @@ cat_line <- function(...) { #' @importFrom utf8 utf8_width #' @importFrom fansi strip_sgr substr_ctl str_trunc <- function(x, width) { - if (all(is.infinite(width))) return(x) + if (all(is.infinite(width))) { + return(x) + } str_width <- utf8_width(strip_sgr(x), encode = FALSE) @@ -38,7 +40,9 @@ slice <- function(df, index) { } bind_rows <- function(x) { - if (length(x) == 0) return(data.frame()) + if (length(x) == 0) { + return(data.frame()) + } eval_tidy(quo(rbind(!!!x))) } @@ -47,12 +51,16 @@ get_ellipsis <- function() { } is_latex_output <- function() { - if (!("knitr" %in% loadedNamespaces())) return(FALSE) + if (!("knitr" %in% loadedNamespaces())) { + return(FALSE) + } get("is_latex_output", asNamespace("knitr"))() } remove_as_is_class <- function(x) { - if (all(class(x) == "AsIs")) return(unclass(x)) + if (all(class(x) == "AsIs")) { + return(unclass(x)) + } class(x) <- setdiff(class(x), "AsIs") x } diff --git a/R/width.R b/R/width.R index f6ff45e48..4e26a4801 100644 --- a/R/width.R +++ b/R/width.R @@ -9,7 +9,9 @@ get_width <- function(x) { # @param x Input to which assign a width or minimum width # @param width,min_width The new width set_width <- function(x, width) { - if (is.null(width)) return(x) + if (is.null(width)) { + return(x) + } if (is.infinite(width)) { attr(x, "width") <- NA_integer_ } else { @@ -28,7 +30,9 @@ get_min_width <- function(x) { # @rdname set_width set_min_width <- function(x, min_width) { - if (is.null(min_width)) return(x) + if (is.null(min_width)) { + return(x) + } attr(x, "min_width") <- as.integer(min_width) x } diff --git a/R/zzz.R b/R/zzz.R index 967357c77..e5d68cc69 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -24,7 +24,7 @@ NULL # Necessary to re-parse environment variable if (requireNamespace("debugme", quietly = TRUE)) { - #activate_debugme() + # activate_debugme() debugme::debugme() debug_info() } diff --git a/data-raw/create-chr-tests.R b/data-raw/create-chr-tests.R index f01f69694..58198baae 100644 --- a/data-raw/create-chr-tests.R +++ b/data-raw/create-chr-tests.R @@ -9,11 +9,11 @@ width <- sample.int(1200, N) + 300L output_width <- sample.int(30, N, replace = TRUE) + 30L code <- paste0( - 'expect_pillar_output(\n', - ' xf = colonnade(df_str[', order, '], width = ', width, '),\n', - ' output_width = ', output_width, ',\n', - ' filename = "str-', sprintf("%.2d", idx), '-', width, '-', output_width, '.txt"\n', - ')' + "expect_pillar_output(\n", + " xf = colonnade(df_str[", order, "], width = ", width, "),\n", + " output_width = ", output_width, ",\n", + ' filename = "str-', sprintf("%.2d", idx), "-", width, "-", output_width, '.txt"\n', + ")" ) cat(code, sep = "\n") diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 3e7370889..1e1624412 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -1,5 +1,7 @@ rlang::with_options( - crayon.enabled = FALSE, crayon.colors = 1L, cli.num_colors = 1L, + crayon.enabled = FALSE, + crayon.colors = 1L, + cli.num_colors = 1L, { num_colors(forget = TRUE) } diff --git a/tests/testthat/test-ctl_colonnade.R b/tests/testthat/test-ctl_colonnade.R index dacb29e10..122b06a6f 100644 --- a/tests/testthat/test-ctl_colonnade.R +++ b/tests/testthat/test-ctl_colonnade.R @@ -10,12 +10,30 @@ test_that("tests from tibble", { expect_snapshot(ctl_colonnade(iris[1:3, ], width = 20)) expect_snapshot(ctl_colonnade(df_all, width = 30)) expect_snapshot(ctl_colonnade(df_all, width = 300)) - expect_snapshot({ options(width = 70); ctl_colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 60); ctl_colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 50); ctl_colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 40); ctl_colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 30); ctl_colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 20); ctl_colonnade(df_all, width = 300) }) + expect_snapshot({ + options(width = 70) + ctl_colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 60) + ctl_colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 50) + ctl_colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 40) + ctl_colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 30) + ctl_colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 20) + ctl_colonnade(df_all, width = 300) + }) expect_snapshot(ctl_colonnade(list(`\n` = c("\n", '"'), `\r` = factor("\n")), width = 30)) expect_snapshot(ctl_colonnade(list(a = c("", " ", "a ", " a")), width = 30)) expect_snapshot(ctl_colonnade(list("mean(x)" = 5, "var(x)" = 3), width = 30)) diff --git a/tests/testthat/test-ctl_colonnade_1.R b/tests/testthat/test-ctl_colonnade_1.R index 721b6b189..4c22e1311 100644 --- a/tests/testthat/test-ctl_colonnade_1.R +++ b/tests/testthat/test-ctl_colonnade_1.R @@ -2,19 +2,64 @@ test_that("strings with varying widths", { local_options(width = 80) # Generated by data-raw/create-chr-tests.R - expect_snapshot({ options(width = 59); ctl_colonnade(df_str[c(12L, 33L, 36L, 7L, 41L, 3L, 18L, 23L, 13L, 44L, 14L, 16L, 25L, 21L, 19L, 45L, 43L, 29L, 1L, 30L, 22L, 27L, 15L, 47L, 28L, 31L, 10L, 50L, 4L, 40L, 42L, 8L, 6L, 9L, 24L, 48L, 38L, 37L, 34L, 49L, 46L, 2L, 32L, 35L, 39L, 11L, 17L, 5L, 26L, 20L)], width = 1382) }) - expect_snapshot({ options(width = 54); ctl_colonnade(df_str[c(40L, 28L, 7L, 16L, 48L, 6L, 21L, 1L, 20L, 17L, 47L, 45L, 29L, 41L, 49L, 34L, 4L, 39L, 18L, 36L, 26L, 38L, 10L, 8L, 5L, 15L, 44L, 24L, 46L, 14L, 25L, 27L, 3L, 37L, 35L, 12L, 9L, 13L, 22L, 33L, 42L, 11L, 19L, 50L, 23L, 30L, 32L, 2L, 43L, 31L)], width = 837) }) - expect_snapshot({ options(width = 32); ctl_colonnade(df_str[c(47L, 42L, 4L, 46L, 9L, 34L, 19L, 39L, 8L, 32L, 36L, 12L, 29L, 5L, 15L, 11L, 31L, 27L, 33L, 28L, 43L, 6L, 13L, 22L, 14L, 16L, 35L, 50L, 38L, 7L, 23L, 45L, 40L, 3L, 2L, 24L, 41L, 10L, 30L, 25L, 17L, 26L, 48L, 37L, 49L, 1L, 18L, 21L, 44L, 20L)], width = 455) }) - expect_snapshot({ options(width = 55); ctl_colonnade(df_str[c(41L, 4L, 25L, 31L, 8L, 22L, 19L, 10L, 29L, 21L, 34L, 5L, 26L, 36L, 47L, 46L, 2L, 24L, 27L, 39L, 28L, 43L, 32L, 30L, 48L, 44L, 6L, 20L, 13L, 15L, 18L, 42L, 9L, 12L, 37L, 45L, 16L, 40L, 11L, 14L, 38L, 1L, 7L, 3L, 23L, 35L, 50L, 17L, 49L, 33L)], width = 855) }) - expect_snapshot({ options(width = 54); ctl_colonnade(df_str[c(27L, 22L, 9L, 23L, 16L, 19L, 25L, 31L, 44L, 1L, 28L, 46L, 12L, 20L, 43L, 37L, 5L, 2L, 18L, 41L, 26L, 33L, 11L, 49L, 24L, 35L, 4L, 47L, 30L, 7L, 34L, 3L, 32L, 42L, 10L, 45L, 38L, 39L, 48L, 14L, 6L, 17L, 36L, 50L, 40L, 13L, 8L, 21L, 15L, 29L)], width = 552) }) - expect_snapshot({ options(width = 49); ctl_colonnade(df_str[c(32L, 24L, 18L, 25L, 26L, 13L, 33L, 2L, 50L, 38L, 37L, 16L, 27L, 9L, 28L, 49L, 34L, 15L, 17L, 35L, 22L, 47L, 3L, 21L, 23L, 41L, 5L, 1L, 14L, 46L, 30L, 31L, 44L, 4L, 7L, 40L, 43L, 12L, 29L, 8L, 36L, 45L, 11L, 20L, 10L, 6L, 19L, 48L, 39L, 42L)], width = 1031) }) - expect_snapshot({ options(width = 38); ctl_colonnade(df_str[c(44L, 34L, 49L, 9L, 15L, 16L, 1L, 10L, 40L, 29L, 26L, 22L, 4L, 43L, 20L, 17L, 46L, 33L, 35L, 32L, 2L, 12L, 8L, 37L, 23L, 39L, 7L, 18L, 36L, 42L, 6L, 30L, 19L, 25L, 5L, 21L, 47L, 50L, 28L, 11L, 31L, 14L, 24L, 27L, 45L, 41L, 38L, 3L, 13L, 48L)], width = 429) }) - expect_snapshot({ options(width = 54); ctl_colonnade(df_str[c(21L, 26L, 8L, 22L, 41L, 24L, 13L, 5L, 47L, 37L, 4L, 42L, 19L, 34L, 11L, 43L, 38L, 3L, 33L, 20L, 31L, 2L, 18L, 48L, 27L, 44L, 9L, 35L, 30L, 6L, 49L, 10L, 1L, 16L, 46L, 29L, 12L, 14L, 45L, 36L, 15L, 39L, 50L, 23L, 17L, 28L, 7L, 32L, 40L, 25L)], width = 633) }) - expect_snapshot({ options(width = 39); ctl_colonnade(df_str[c(23L, 49L, 13L, 37L, 3L, 25L, 36L, 4L, 9L, 7L, 27L, 48L, 12L, 10L, 50L, 14L, 38L, 39L, 46L, 22L, 28L, 8L, 21L, 44L, 32L, 40L, 31L, 1L, 29L, 34L, 35L, 33L, 19L, 15L, 41L, 20L, 47L, 18L, 16L, 45L, 6L, 5L, 24L, 26L, 43L, 11L, 42L, 30L, 17L, 2L)], width = 1496) }) - expect_snapshot({ options(width = 31); ctl_colonnade(df_str[c(45L, 14L, 49L, 24L, 22L, 31L, 42L, 18L, 16L, 47L, 25L, 4L, 37L, 8L, 26L, 21L, 50L, 5L, 41L, 30L, 2L, 33L, 34L, 3L, 44L, 19L, 43L, 6L, 32L, 29L, 20L, 1L, 13L, 11L, 40L, 12L, 48L, 23L, 9L, 15L, 46L, 36L, 27L, 35L, 28L, 10L, 7L, 39L, 17L, 38L)], width = 493) }) - expect_snapshot({ options(width = 52); ctl_colonnade(df_str[c(38L, 46L, 17L, 11L, 24L, 18L, 16L, 39L, 50L, 42L, 6L, 13L, 37L, 29L, 41L, 47L, 9L, 33L, 44L, 31L, 45L, 36L, 28L, 5L, 10L, 30L, 20L, 1L, 14L, 43L, 49L, 23L, 26L, 21L, 32L, 19L, 34L, 15L, 48L, 4L, 7L, 35L, 40L, 8L, 22L, 3L, 25L, 12L, 27L, 2L)], width = 1130) }) - expect_snapshot({ options(width = 58); ctl_colonnade(df_str[c(17L, 28L, 29L, 27L, 20L, 31L, 43L, 30L, 32L, 48L, 10L, 50L, 13L, 12L, 36L, 21L, 46L, 33L, 25L, 35L, 1L, 5L, 16L, 34L, 18L, 42L, 3L, 11L, 40L, 26L, 37L, 7L, 39L, 6L, 4L, 19L, 8L, 45L, 14L, 24L, 23L, 2L, 47L, 9L, 49L, 41L, 38L, 22L, 44L, 15L)], width = 1310) }) - expect_snapshot({ options(width = 47); ctl_colonnade(df_str[c(1L, 26L, 20L, 12L, 49L, 16L, 24L, 4L, 15L, 47L, 8L, 11L, 14L, 50L, 17L, 2L, 44L, 30L, 36L, 45L, 25L, 38L, 18L, 29L, 5L, 13L, 3L, 23L, 48L, 40L, 34L, 22L, 39L, 33L, 27L, 7L, 19L, 10L, 37L, 6L, 35L, 46L, 31L, 41L, 43L, 28L, 42L, 32L, 21L, 9L)], width = 484) }) - expect_snapshot({ options(width = 55); ctl_colonnade(df_str[c(6L, 49L, 26L, 45L, 25L, 15L, 31L, 20L, 21L, 44L, 23L, 48L, 37L, 36L, 5L, 43L, 11L, 14L, 13L, 39L, 16L, 12L, 4L, 18L, 42L, 3L, 10L, 28L, 40L, 24L, 29L, 17L, 35L, 47L, 2L, 38L, 34L, 9L, 7L, 8L, 50L, 33L, 32L, 27L, 46L, 19L, 22L, 41L, 30L, 1L)], width = 779) }) - expect_snapshot({ options(width = 46); ctl_colonnade(df_str[c(38L, 42L, 41L, 10L, 40L, 11L, 27L, 9L, 17L, 37L, 46L, 13L, 36L, 18L, 31L, 20L, 39L, 12L, 44L, 33L, 50L, 34L, 26L, 32L, 23L, 30L, 29L, 21L, 4L, 49L, 19L, 25L, 3L, 6L, 15L, 14L, 43L, 48L, 8L, 22L, 1L, 2L, 45L, 35L, 16L, 5L, 47L, 28L, 24L, 7L)], width = 694) }) + expect_snapshot({ + options(width = 59) + ctl_colonnade(df_str[c(12L, 33L, 36L, 7L, 41L, 3L, 18L, 23L, 13L, 44L, 14L, 16L, 25L, 21L, 19L, 45L, 43L, 29L, 1L, 30L, 22L, 27L, 15L, 47L, 28L, 31L, 10L, 50L, 4L, 40L, 42L, 8L, 6L, 9L, 24L, 48L, 38L, 37L, 34L, 49L, 46L, 2L, 32L, 35L, 39L, 11L, 17L, 5L, 26L, 20L)], width = 1382) + }) + expect_snapshot({ + options(width = 54) + ctl_colonnade(df_str[c(40L, 28L, 7L, 16L, 48L, 6L, 21L, 1L, 20L, 17L, 47L, 45L, 29L, 41L, 49L, 34L, 4L, 39L, 18L, 36L, 26L, 38L, 10L, 8L, 5L, 15L, 44L, 24L, 46L, 14L, 25L, 27L, 3L, 37L, 35L, 12L, 9L, 13L, 22L, 33L, 42L, 11L, 19L, 50L, 23L, 30L, 32L, 2L, 43L, 31L)], width = 837) + }) + expect_snapshot({ + options(width = 32) + ctl_colonnade(df_str[c(47L, 42L, 4L, 46L, 9L, 34L, 19L, 39L, 8L, 32L, 36L, 12L, 29L, 5L, 15L, 11L, 31L, 27L, 33L, 28L, 43L, 6L, 13L, 22L, 14L, 16L, 35L, 50L, 38L, 7L, 23L, 45L, 40L, 3L, 2L, 24L, 41L, 10L, 30L, 25L, 17L, 26L, 48L, 37L, 49L, 1L, 18L, 21L, 44L, 20L)], width = 455) + }) + expect_snapshot({ + options(width = 55) + ctl_colonnade(df_str[c(41L, 4L, 25L, 31L, 8L, 22L, 19L, 10L, 29L, 21L, 34L, 5L, 26L, 36L, 47L, 46L, 2L, 24L, 27L, 39L, 28L, 43L, 32L, 30L, 48L, 44L, 6L, 20L, 13L, 15L, 18L, 42L, 9L, 12L, 37L, 45L, 16L, 40L, 11L, 14L, 38L, 1L, 7L, 3L, 23L, 35L, 50L, 17L, 49L, 33L)], width = 855) + }) + expect_snapshot({ + options(width = 54) + ctl_colonnade(df_str[c(27L, 22L, 9L, 23L, 16L, 19L, 25L, 31L, 44L, 1L, 28L, 46L, 12L, 20L, 43L, 37L, 5L, 2L, 18L, 41L, 26L, 33L, 11L, 49L, 24L, 35L, 4L, 47L, 30L, 7L, 34L, 3L, 32L, 42L, 10L, 45L, 38L, 39L, 48L, 14L, 6L, 17L, 36L, 50L, 40L, 13L, 8L, 21L, 15L, 29L)], width = 552) + }) + expect_snapshot({ + options(width = 49) + ctl_colonnade(df_str[c(32L, 24L, 18L, 25L, 26L, 13L, 33L, 2L, 50L, 38L, 37L, 16L, 27L, 9L, 28L, 49L, 34L, 15L, 17L, 35L, 22L, 47L, 3L, 21L, 23L, 41L, 5L, 1L, 14L, 46L, 30L, 31L, 44L, 4L, 7L, 40L, 43L, 12L, 29L, 8L, 36L, 45L, 11L, 20L, 10L, 6L, 19L, 48L, 39L, 42L)], width = 1031) + }) + expect_snapshot({ + options(width = 38) + ctl_colonnade(df_str[c(44L, 34L, 49L, 9L, 15L, 16L, 1L, 10L, 40L, 29L, 26L, 22L, 4L, 43L, 20L, 17L, 46L, 33L, 35L, 32L, 2L, 12L, 8L, 37L, 23L, 39L, 7L, 18L, 36L, 42L, 6L, 30L, 19L, 25L, 5L, 21L, 47L, 50L, 28L, 11L, 31L, 14L, 24L, 27L, 45L, 41L, 38L, 3L, 13L, 48L)], width = 429) + }) + expect_snapshot({ + options(width = 54) + ctl_colonnade(df_str[c(21L, 26L, 8L, 22L, 41L, 24L, 13L, 5L, 47L, 37L, 4L, 42L, 19L, 34L, 11L, 43L, 38L, 3L, 33L, 20L, 31L, 2L, 18L, 48L, 27L, 44L, 9L, 35L, 30L, 6L, 49L, 10L, 1L, 16L, 46L, 29L, 12L, 14L, 45L, 36L, 15L, 39L, 50L, 23L, 17L, 28L, 7L, 32L, 40L, 25L)], width = 633) + }) + expect_snapshot({ + options(width = 39) + ctl_colonnade(df_str[c(23L, 49L, 13L, 37L, 3L, 25L, 36L, 4L, 9L, 7L, 27L, 48L, 12L, 10L, 50L, 14L, 38L, 39L, 46L, 22L, 28L, 8L, 21L, 44L, 32L, 40L, 31L, 1L, 29L, 34L, 35L, 33L, 19L, 15L, 41L, 20L, 47L, 18L, 16L, 45L, 6L, 5L, 24L, 26L, 43L, 11L, 42L, 30L, 17L, 2L)], width = 1496) + }) + expect_snapshot({ + options(width = 31) + ctl_colonnade(df_str[c(45L, 14L, 49L, 24L, 22L, 31L, 42L, 18L, 16L, 47L, 25L, 4L, 37L, 8L, 26L, 21L, 50L, 5L, 41L, 30L, 2L, 33L, 34L, 3L, 44L, 19L, 43L, 6L, 32L, 29L, 20L, 1L, 13L, 11L, 40L, 12L, 48L, 23L, 9L, 15L, 46L, 36L, 27L, 35L, 28L, 10L, 7L, 39L, 17L, 38L)], width = 493) + }) + expect_snapshot({ + options(width = 52) + ctl_colonnade(df_str[c(38L, 46L, 17L, 11L, 24L, 18L, 16L, 39L, 50L, 42L, 6L, 13L, 37L, 29L, 41L, 47L, 9L, 33L, 44L, 31L, 45L, 36L, 28L, 5L, 10L, 30L, 20L, 1L, 14L, 43L, 49L, 23L, 26L, 21L, 32L, 19L, 34L, 15L, 48L, 4L, 7L, 35L, 40L, 8L, 22L, 3L, 25L, 12L, 27L, 2L)], width = 1130) + }) + expect_snapshot({ + options(width = 58) + ctl_colonnade(df_str[c(17L, 28L, 29L, 27L, 20L, 31L, 43L, 30L, 32L, 48L, 10L, 50L, 13L, 12L, 36L, 21L, 46L, 33L, 25L, 35L, 1L, 5L, 16L, 34L, 18L, 42L, 3L, 11L, 40L, 26L, 37L, 7L, 39L, 6L, 4L, 19L, 8L, 45L, 14L, 24L, 23L, 2L, 47L, 9L, 49L, 41L, 38L, 22L, 44L, 15L)], width = 1310) + }) + expect_snapshot({ + options(width = 47) + ctl_colonnade(df_str[c(1L, 26L, 20L, 12L, 49L, 16L, 24L, 4L, 15L, 47L, 8L, 11L, 14L, 50L, 17L, 2L, 44L, 30L, 36L, 45L, 25L, 38L, 18L, 29L, 5L, 13L, 3L, 23L, 48L, 40L, 34L, 22L, 39L, 33L, 27L, 7L, 19L, 10L, 37L, 6L, 35L, 46L, 31L, 41L, 43L, 28L, 42L, 32L, 21L, 9L)], width = 484) + }) + expect_snapshot({ + options(width = 55) + ctl_colonnade(df_str[c(6L, 49L, 26L, 45L, 25L, 15L, 31L, 20L, 21L, 44L, 23L, 48L, 37L, 36L, 5L, 43L, 11L, 14L, 13L, 39L, 16L, 12L, 4L, 18L, 42L, 3L, 10L, 28L, 40L, 24L, 29L, 17L, 35L, 47L, 2L, 38L, 34L, 9L, 7L, 8L, 50L, 33L, 32L, 27L, 46L, 19L, 22L, 41L, 30L, 1L)], width = 779) + }) + expect_snapshot({ + options(width = 46) + ctl_colonnade(df_str[c(38L, 42L, 41L, 10L, 40L, 11L, 27L, 9L, 17L, 37L, 46L, 13L, 36L, 18L, 31L, 20L, 39L, 12L, 44L, 33L, 50L, 34L, 26L, 32L, 23L, 30L, 29L, 21L, 4L, 49L, 19L, 25L, 3L, 6L, 15L, 14L, 43L, 48L, 8L, 22L, 1L, 2L, 45L, 35L, 16L, 5L, 47L, 28L, 24L, 7L)], width = 694) + }) }) diff --git a/tests/testthat/test-ctl_colonnade_2.R b/tests/testthat/test-ctl_colonnade_2.R index 2dc4237aa..ad4adac03 100644 --- a/tests/testthat/test-ctl_colonnade_2.R +++ b/tests/testthat/test-ctl_colonnade_2.R @@ -2,19 +2,64 @@ test_that("strings with varying widths", { local_options(width = 80) # Generated by data-raw/create-chr-tests.R - expect_snapshot({ options(width = 54); ctl_colonnade(df_str[c(28L, 34L, 16L, 29L, 47L, 25L, 42L, 27L, 44L, 20L, 14L, 36L, 43L, 41L, 26L, 45L, 22L, 9L, 13L, 32L, 31L, 12L, 19L, 48L, 49L, 35L, 3L, 11L, 23L, 24L, 40L, 15L, 38L, 10L, 46L, 5L, 50L, 18L, 21L, 6L, 30L, 2L, 7L, 1L, 4L, 8L, 17L, 33L, 39L, 37L)], width = 516) }) - expect_snapshot({ options(width = 42); ctl_colonnade(df_str[c(28L, 41L, 12L, 29L, 13L, 43L, 24L, 50L, 48L, 35L, 44L, 21L, 33L, 45L, 47L, 34L, 25L, 14L, 18L, 23L, 7L, 3L, 42L, 36L, 11L, 2L, 20L, 31L, 1L, 4L, 38L, 9L, 27L, 40L, 32L, 17L, 6L, 49L, 16L, 19L, 15L, 22L, 39L, 10L, 46L, 5L, 30L, 8L, 26L, 37L)], width = 1365) }) - expect_snapshot({ options(width = 39); ctl_colonnade(df_str[c(40L, 17L, 13L, 23L, 22L, 2L, 18L, 3L, 29L, 45L, 14L, 19L, 33L, 37L, 47L, 43L, 44L, 10L, 31L, 27L, 34L, 35L, 41L, 21L, 4L, 25L, 38L, 48L, 9L, 24L, 26L, 39L, 20L, 36L, 42L, 16L, 6L, 11L, 7L, 12L, 1L, 46L, 15L, 5L, 8L, 50L, 32L, 30L, 49L, 28L)], width = 934) }) - expect_snapshot({ options(width = 32); ctl_colonnade(df_str[c(11L, 36L, 17L, 14L, 31L, 35L, 23L, 13L, 6L, 44L, 45L, 22L, 21L, 18L, 33L, 10L, 43L, 2L, 46L, 34L, 3L, 19L, 1L, 38L, 9L, 37L, 5L, 8L, 25L, 49L, 27L, 29L, 15L, 39L, 24L, 40L, 48L, 26L, 47L, 42L, 41L, 12L, 28L, 30L, 7L, 16L, 4L, 50L, 20L, 32L)], width = 565) }) - expect_snapshot({ options(width = 35); ctl_colonnade(df_str[c(18L, 46L, 11L, 43L, 31L, 47L, 48L, 44L, 50L, 15L, 28L, 33L, 13L, 4L, 22L, 3L, 37L, 32L, 40L, 9L, 25L, 16L, 45L, 23L, 21L, 6L, 49L, 36L, 27L, 38L, 14L, 34L, 8L, 24L, 29L, 1L, 12L, 2L, 20L, 17L, 35L, 5L, 19L, 30L, 7L, 26L, 42L, 41L, 39L, 10L)], width = 1121) }) - expect_snapshot({ options(width = 32); ctl_colonnade(df_str[c(43L, 1L, 3L, 15L, 28L, 12L, 46L, 34L, 31L, 7L, 11L, 4L, 44L, 8L, 9L, 5L, 36L, 22L, 17L, 39L, 18L, 45L, 37L, 13L, 29L, 6L, 30L, 16L, 20L, 10L, 19L, 26L, 33L, 40L, 35L, 48L, 38L, 25L, 2L, 47L, 42L, 41L, 27L, 14L, 21L, 24L, 50L, 49L, 23L, 32L)], width = 446) }) - expect_snapshot({ options(width = 31); ctl_colonnade(df_str[c(37L, 46L, 21L, 3L, 16L, 39L, 34L, 33L, 10L, 17L, 19L, 36L, 45L, 49L, 11L, 50L, 14L, 29L, 44L, 13L, 30L, 38L, 32L, 40L, 42L, 1L, 31L, 41L, 7L, 23L, 35L, 28L, 6L, 25L, 2L, 9L, 12L, 15L, 5L, 18L, 20L, 27L, 43L, 8L, 47L, 4L, 48L, 24L, 26L, 22L)], width = 1166) }) - expect_snapshot({ options(width = 58); ctl_colonnade(df_str[c(31L, 39L, 40L, 30L, 10L, 21L, 9L, 16L, 46L, 25L, 15L, 24L, 3L, 50L, 35L, 1L, 12L, 34L, 48L, 4L, 29L, 23L, 37L, 36L, 28L, 43L, 11L, 17L, 32L, 8L, 41L, 13L, 44L, 7L, 38L, 26L, 33L, 20L, 19L, 2L, 18L, 49L, 27L, 47L, 22L, 14L, 6L, 5L, 45L, 42L)], width = 546) }) - expect_snapshot({ options(width = 57); ctl_colonnade(df_str[c(43L, 21L, 41L, 48L, 22L, 25L, 2L, 8L, 1L, 24L, 6L, 39L, 38L, 20L, 49L, 45L, 47L, 12L, 9L, 13L, 36L, 26L, 44L, 11L, 46L, 28L, 7L, 18L, 50L, 16L, 29L, 30L, 4L, 23L, 17L, 40L, 33L, 14L, 27L, 19L, 34L, 32L, 3L, 37L, 15L, 10L, 5L, 35L, 31L, 42L)], width = 1035) }) - expect_snapshot({ options(width = 33); ctl_colonnade(df_str[c(40L, 6L, 25L, 5L, 26L, 17L, 19L, 2L, 11L, 34L, 45L, 24L, 22L, 44L, 35L, 7L, 4L, 49L, 1L, 36L, 12L, 41L, 39L, 13L, 48L, 27L, 18L, 30L, 42L, 28L, 3L, 46L, 21L, 20L, 16L, 29L, 50L, 10L, 9L, 8L, 47L, 31L, 14L, 38L, 33L, 32L, 43L, 23L, 15L, 37L)], width = 1217) }) - expect_snapshot({ options(width = 32); ctl_colonnade(df_str[c(43L, 23L, 22L, 11L, 6L, 26L, 48L, 17L, 7L, 42L, 36L, 21L, 35L, 50L, 13L, 19L, 29L, 8L, 15L, 4L, 2L, 27L, 49L, 47L, 30L, 31L, 25L, 28L, 46L, 12L, 32L, 39L, 24L, 10L, 45L, 5L, 37L, 14L, 40L, 20L, 41L, 44L, 33L, 18L, 38L, 3L, 1L, 34L, 16L, 9L)], width = 770) }) - expect_snapshot({ options(width = 46); ctl_colonnade(df_str[c(5L, 24L, 43L, 46L, 35L, 39L, 18L, 26L, 8L, 27L, 2L, 50L, 6L, 14L, 29L, 47L, 9L, 16L, 36L, 4L, 13L, 41L, 3L, 28L, 37L, 33L, 38L, 31L, 34L, 19L, 42L, 32L, 1L, 45L, 15L, 7L, 11L, 49L, 23L, 12L, 48L, 20L, 21L, 44L, 25L, 10L, 22L, 30L, 40L, 17L)], width = 1439) }) - expect_snapshot({ options(width = 52); ctl_colonnade(df_str[c(7L, 44L, 19L, 21L, 18L, 35L, 23L, 50L, 33L, 37L, 25L, 26L, 10L, 39L, 2L, 47L, 42L, 14L, 9L, 41L, 45L, 6L, 4L, 11L, 24L, 43L, 32L, 3L, 38L, 5L, 49L, 27L, 17L, 8L, 22L, 40L, 12L, 15L, 1L, 28L, 31L, 29L, 13L, 48L, 34L, 36L, 30L, 20L, 16L, 46L)], width = 1065) }) - expect_snapshot({ options(width = 35); ctl_colonnade(df_str[c(38L, 18L, 23L, 36L, 35L, 20L, 44L, 19L, 13L, 41L, 31L, 7L, 11L, 29L, 2L, 14L, 26L, 46L, 40L, 45L, 9L, 34L, 33L, 22L, 1L, 17L, 28L, 10L, 21L, 30L, 47L, 49L, 6L, 12L, 4L, 25L, 32L, 15L, 43L, 24L, 48L, 3L, 37L, 50L, 42L, 39L, 16L, 8L, 27L, 5L)], width = 393) }) - expect_snapshot({ options(width = 41); ctl_colonnade(df_str[c(22L, 9L, 11L, 26L, 19L, 16L, 32L, 25L, 1L, 30L, 31L, 6L, 24L, 10L, 39L, 21L, 50L, 7L, 29L, 12L, 46L, 43L, 15L, 35L, 20L, 40L, 49L, 38L, 36L, 48L, 34L, 3L, 8L, 4L, 27L, 42L, 44L, 33L, 45L, 18L, 5L, 2L, 13L, 47L, 28L, 17L, 37L, 14L, 41L, 23L)], width = 999) }) + expect_snapshot({ + options(width = 54) + ctl_colonnade(df_str[c(28L, 34L, 16L, 29L, 47L, 25L, 42L, 27L, 44L, 20L, 14L, 36L, 43L, 41L, 26L, 45L, 22L, 9L, 13L, 32L, 31L, 12L, 19L, 48L, 49L, 35L, 3L, 11L, 23L, 24L, 40L, 15L, 38L, 10L, 46L, 5L, 50L, 18L, 21L, 6L, 30L, 2L, 7L, 1L, 4L, 8L, 17L, 33L, 39L, 37L)], width = 516) + }) + expect_snapshot({ + options(width = 42) + ctl_colonnade(df_str[c(28L, 41L, 12L, 29L, 13L, 43L, 24L, 50L, 48L, 35L, 44L, 21L, 33L, 45L, 47L, 34L, 25L, 14L, 18L, 23L, 7L, 3L, 42L, 36L, 11L, 2L, 20L, 31L, 1L, 4L, 38L, 9L, 27L, 40L, 32L, 17L, 6L, 49L, 16L, 19L, 15L, 22L, 39L, 10L, 46L, 5L, 30L, 8L, 26L, 37L)], width = 1365) + }) + expect_snapshot({ + options(width = 39) + ctl_colonnade(df_str[c(40L, 17L, 13L, 23L, 22L, 2L, 18L, 3L, 29L, 45L, 14L, 19L, 33L, 37L, 47L, 43L, 44L, 10L, 31L, 27L, 34L, 35L, 41L, 21L, 4L, 25L, 38L, 48L, 9L, 24L, 26L, 39L, 20L, 36L, 42L, 16L, 6L, 11L, 7L, 12L, 1L, 46L, 15L, 5L, 8L, 50L, 32L, 30L, 49L, 28L)], width = 934) + }) + expect_snapshot({ + options(width = 32) + ctl_colonnade(df_str[c(11L, 36L, 17L, 14L, 31L, 35L, 23L, 13L, 6L, 44L, 45L, 22L, 21L, 18L, 33L, 10L, 43L, 2L, 46L, 34L, 3L, 19L, 1L, 38L, 9L, 37L, 5L, 8L, 25L, 49L, 27L, 29L, 15L, 39L, 24L, 40L, 48L, 26L, 47L, 42L, 41L, 12L, 28L, 30L, 7L, 16L, 4L, 50L, 20L, 32L)], width = 565) + }) + expect_snapshot({ + options(width = 35) + ctl_colonnade(df_str[c(18L, 46L, 11L, 43L, 31L, 47L, 48L, 44L, 50L, 15L, 28L, 33L, 13L, 4L, 22L, 3L, 37L, 32L, 40L, 9L, 25L, 16L, 45L, 23L, 21L, 6L, 49L, 36L, 27L, 38L, 14L, 34L, 8L, 24L, 29L, 1L, 12L, 2L, 20L, 17L, 35L, 5L, 19L, 30L, 7L, 26L, 42L, 41L, 39L, 10L)], width = 1121) + }) + expect_snapshot({ + options(width = 32) + ctl_colonnade(df_str[c(43L, 1L, 3L, 15L, 28L, 12L, 46L, 34L, 31L, 7L, 11L, 4L, 44L, 8L, 9L, 5L, 36L, 22L, 17L, 39L, 18L, 45L, 37L, 13L, 29L, 6L, 30L, 16L, 20L, 10L, 19L, 26L, 33L, 40L, 35L, 48L, 38L, 25L, 2L, 47L, 42L, 41L, 27L, 14L, 21L, 24L, 50L, 49L, 23L, 32L)], width = 446) + }) + expect_snapshot({ + options(width = 31) + ctl_colonnade(df_str[c(37L, 46L, 21L, 3L, 16L, 39L, 34L, 33L, 10L, 17L, 19L, 36L, 45L, 49L, 11L, 50L, 14L, 29L, 44L, 13L, 30L, 38L, 32L, 40L, 42L, 1L, 31L, 41L, 7L, 23L, 35L, 28L, 6L, 25L, 2L, 9L, 12L, 15L, 5L, 18L, 20L, 27L, 43L, 8L, 47L, 4L, 48L, 24L, 26L, 22L)], width = 1166) + }) + expect_snapshot({ + options(width = 58) + ctl_colonnade(df_str[c(31L, 39L, 40L, 30L, 10L, 21L, 9L, 16L, 46L, 25L, 15L, 24L, 3L, 50L, 35L, 1L, 12L, 34L, 48L, 4L, 29L, 23L, 37L, 36L, 28L, 43L, 11L, 17L, 32L, 8L, 41L, 13L, 44L, 7L, 38L, 26L, 33L, 20L, 19L, 2L, 18L, 49L, 27L, 47L, 22L, 14L, 6L, 5L, 45L, 42L)], width = 546) + }) + expect_snapshot({ + options(width = 57) + ctl_colonnade(df_str[c(43L, 21L, 41L, 48L, 22L, 25L, 2L, 8L, 1L, 24L, 6L, 39L, 38L, 20L, 49L, 45L, 47L, 12L, 9L, 13L, 36L, 26L, 44L, 11L, 46L, 28L, 7L, 18L, 50L, 16L, 29L, 30L, 4L, 23L, 17L, 40L, 33L, 14L, 27L, 19L, 34L, 32L, 3L, 37L, 15L, 10L, 5L, 35L, 31L, 42L)], width = 1035) + }) + expect_snapshot({ + options(width = 33) + ctl_colonnade(df_str[c(40L, 6L, 25L, 5L, 26L, 17L, 19L, 2L, 11L, 34L, 45L, 24L, 22L, 44L, 35L, 7L, 4L, 49L, 1L, 36L, 12L, 41L, 39L, 13L, 48L, 27L, 18L, 30L, 42L, 28L, 3L, 46L, 21L, 20L, 16L, 29L, 50L, 10L, 9L, 8L, 47L, 31L, 14L, 38L, 33L, 32L, 43L, 23L, 15L, 37L)], width = 1217) + }) + expect_snapshot({ + options(width = 32) + ctl_colonnade(df_str[c(43L, 23L, 22L, 11L, 6L, 26L, 48L, 17L, 7L, 42L, 36L, 21L, 35L, 50L, 13L, 19L, 29L, 8L, 15L, 4L, 2L, 27L, 49L, 47L, 30L, 31L, 25L, 28L, 46L, 12L, 32L, 39L, 24L, 10L, 45L, 5L, 37L, 14L, 40L, 20L, 41L, 44L, 33L, 18L, 38L, 3L, 1L, 34L, 16L, 9L)], width = 770) + }) + expect_snapshot({ + options(width = 46) + ctl_colonnade(df_str[c(5L, 24L, 43L, 46L, 35L, 39L, 18L, 26L, 8L, 27L, 2L, 50L, 6L, 14L, 29L, 47L, 9L, 16L, 36L, 4L, 13L, 41L, 3L, 28L, 37L, 33L, 38L, 31L, 34L, 19L, 42L, 32L, 1L, 45L, 15L, 7L, 11L, 49L, 23L, 12L, 48L, 20L, 21L, 44L, 25L, 10L, 22L, 30L, 40L, 17L)], width = 1439) + }) + expect_snapshot({ + options(width = 52) + ctl_colonnade(df_str[c(7L, 44L, 19L, 21L, 18L, 35L, 23L, 50L, 33L, 37L, 25L, 26L, 10L, 39L, 2L, 47L, 42L, 14L, 9L, 41L, 45L, 6L, 4L, 11L, 24L, 43L, 32L, 3L, 38L, 5L, 49L, 27L, 17L, 8L, 22L, 40L, 12L, 15L, 1L, 28L, 31L, 29L, 13L, 48L, 34L, 36L, 30L, 20L, 16L, 46L)], width = 1065) + }) + expect_snapshot({ + options(width = 35) + ctl_colonnade(df_str[c(38L, 18L, 23L, 36L, 35L, 20L, 44L, 19L, 13L, 41L, 31L, 7L, 11L, 29L, 2L, 14L, 26L, 46L, 40L, 45L, 9L, 34L, 33L, 22L, 1L, 17L, 28L, 10L, 21L, 30L, 47L, 49L, 6L, 12L, 4L, 25L, 32L, 15L, 43L, 24L, 48L, 3L, 37L, 50L, 42L, 39L, 16L, 8L, 27L, 5L)], width = 393) + }) + expect_snapshot({ + options(width = 41) + ctl_colonnade(df_str[c(22L, 9L, 11L, 26L, 19L, 16L, 32L, 25L, 1L, 30L, 31L, 6L, 24L, 10L, 39L, 21L, 50L, 7L, 29L, 12L, 46L, 43L, 15L, 35L, 20L, 40L, 49L, 38L, 36L, 48L, 34L, 3L, 8L, 4L, 27L, 42L, 44L, 33L, 45L, 18L, 5L, 2L, 13L, 47L, 28L, 17L, 37L, 14L, 41L, 23L)], width = 999) + }) }) diff --git a/tests/testthat/test-format_character.R b/tests/testthat/test-format_character.R index 10d488544..4d5af4bc4 100644 --- a/tests/testthat/test-format_character.R +++ b/tests/testthat/test-format_character.R @@ -87,7 +87,7 @@ test_that("output test", { test_that("output test (not on Windows)", { skip_on_os("windows") - if(getRversion() == "4.0.4") { + if (getRversion() == "4.0.4") { # This seems to show differently on the Mac: # writeLines(evaluate::evaluate('c("\\u6210", "\\u6210")')[[1]]$src) skip_on_os("mac") diff --git a/tests/testthat/test-format_multi.R b/tests/testthat/test-format_multi.R index 0c4ef3adc..f906353e3 100644 --- a/tests/testthat/test-format_multi.R +++ b/tests/testthat/test-format_multi.R @@ -83,12 +83,30 @@ test_that("tests from tibble", { expect_snapshot(colonnade(iris[1:3, ], width = 20)) expect_snapshot(colonnade(df_all, width = 30)) expect_snapshot(colonnade(df_all, width = 300)) - expect_snapshot({ options(width = 70); colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 60); colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 50); colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 40); colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 30); colonnade(df_all, width = 300) }) - expect_snapshot({ options(width = 20); colonnade(df_all, width = 300) }) + expect_snapshot({ + options(width = 70) + colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 60) + colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 50) + colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 40) + colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 30) + colonnade(df_all, width = 300) + }) + expect_snapshot({ + options(width = 20) + colonnade(df_all, width = 300) + }) expect_snapshot(colonnade(list(`\n` = c("\n", '"'), `\r` = factor("\n")), width = 30)) expect_snapshot(colonnade(list(a = c("", " ", "a ", " a")), width = 30)) expect_snapshot(colonnade(list("mean(x)" = 5, "var(x)" = 3), width = 30)) diff --git a/tests/testthat/test-format_multi_fuzz.R b/tests/testthat/test-format_multi_fuzz.R index 2eded0603..bfe127ecd 100644 --- a/tests/testthat/test-format_multi_fuzz.R +++ b/tests/testthat/test-format_multi_fuzz.R @@ -2,19 +2,64 @@ test_that("strings with varying widths", { local_options(width = 80) # Generated by data-raw/create-chr-tests.R - expect_snapshot({ options(width = 59); colonnade(df_str[c(12L, 33L, 36L, 7L, 41L, 3L, 18L, 23L, 13L, 44L, 14L, 16L, 25L, 21L, 19L, 45L, 43L, 29L, 1L, 30L, 22L, 27L, 15L, 47L, 28L, 31L, 10L, 50L, 4L, 40L, 42L, 8L, 6L, 9L, 24L, 48L, 38L, 37L, 34L, 49L, 46L, 2L, 32L, 35L, 39L, 11L, 17L, 5L, 26L, 20L)], width = 1382) }) - expect_snapshot({ options(width = 54); colonnade(df_str[c(40L, 28L, 7L, 16L, 48L, 6L, 21L, 1L, 20L, 17L, 47L, 45L, 29L, 41L, 49L, 34L, 4L, 39L, 18L, 36L, 26L, 38L, 10L, 8L, 5L, 15L, 44L, 24L, 46L, 14L, 25L, 27L, 3L, 37L, 35L, 12L, 9L, 13L, 22L, 33L, 42L, 11L, 19L, 50L, 23L, 30L, 32L, 2L, 43L, 31L)], width = 837) }) - expect_snapshot({ options(width = 32); colonnade(df_str[c(47L, 42L, 4L, 46L, 9L, 34L, 19L, 39L, 8L, 32L, 36L, 12L, 29L, 5L, 15L, 11L, 31L, 27L, 33L, 28L, 43L, 6L, 13L, 22L, 14L, 16L, 35L, 50L, 38L, 7L, 23L, 45L, 40L, 3L, 2L, 24L, 41L, 10L, 30L, 25L, 17L, 26L, 48L, 37L, 49L, 1L, 18L, 21L, 44L, 20L)], width = 455) }) - expect_snapshot({ options(width = 55); colonnade(df_str[c(41L, 4L, 25L, 31L, 8L, 22L, 19L, 10L, 29L, 21L, 34L, 5L, 26L, 36L, 47L, 46L, 2L, 24L, 27L, 39L, 28L, 43L, 32L, 30L, 48L, 44L, 6L, 20L, 13L, 15L, 18L, 42L, 9L, 12L, 37L, 45L, 16L, 40L, 11L, 14L, 38L, 1L, 7L, 3L, 23L, 35L, 50L, 17L, 49L, 33L)], width = 855) }) - expect_snapshot({ options(width = 54); colonnade(df_str[c(27L, 22L, 9L, 23L, 16L, 19L, 25L, 31L, 44L, 1L, 28L, 46L, 12L, 20L, 43L, 37L, 5L, 2L, 18L, 41L, 26L, 33L, 11L, 49L, 24L, 35L, 4L, 47L, 30L, 7L, 34L, 3L, 32L, 42L, 10L, 45L, 38L, 39L, 48L, 14L, 6L, 17L, 36L, 50L, 40L, 13L, 8L, 21L, 15L, 29L)], width = 552) }) - expect_snapshot({ options(width = 49); colonnade(df_str[c(32L, 24L, 18L, 25L, 26L, 13L, 33L, 2L, 50L, 38L, 37L, 16L, 27L, 9L, 28L, 49L, 34L, 15L, 17L, 35L, 22L, 47L, 3L, 21L, 23L, 41L, 5L, 1L, 14L, 46L, 30L, 31L, 44L, 4L, 7L, 40L, 43L, 12L, 29L, 8L, 36L, 45L, 11L, 20L, 10L, 6L, 19L, 48L, 39L, 42L)], width = 1031) }) - expect_snapshot({ options(width = 38); colonnade(df_str[c(44L, 34L, 49L, 9L, 15L, 16L, 1L, 10L, 40L, 29L, 26L, 22L, 4L, 43L, 20L, 17L, 46L, 33L, 35L, 32L, 2L, 12L, 8L, 37L, 23L, 39L, 7L, 18L, 36L, 42L, 6L, 30L, 19L, 25L, 5L, 21L, 47L, 50L, 28L, 11L, 31L, 14L, 24L, 27L, 45L, 41L, 38L, 3L, 13L, 48L)], width = 429) }) - expect_snapshot({ options(width = 54); colonnade(df_str[c(21L, 26L, 8L, 22L, 41L, 24L, 13L, 5L, 47L, 37L, 4L, 42L, 19L, 34L, 11L, 43L, 38L, 3L, 33L, 20L, 31L, 2L, 18L, 48L, 27L, 44L, 9L, 35L, 30L, 6L, 49L, 10L, 1L, 16L, 46L, 29L, 12L, 14L, 45L, 36L, 15L, 39L, 50L, 23L, 17L, 28L, 7L, 32L, 40L, 25L)], width = 633) }) - expect_snapshot({ options(width = 39); colonnade(df_str[c(23L, 49L, 13L, 37L, 3L, 25L, 36L, 4L, 9L, 7L, 27L, 48L, 12L, 10L, 50L, 14L, 38L, 39L, 46L, 22L, 28L, 8L, 21L, 44L, 32L, 40L, 31L, 1L, 29L, 34L, 35L, 33L, 19L, 15L, 41L, 20L, 47L, 18L, 16L, 45L, 6L, 5L, 24L, 26L, 43L, 11L, 42L, 30L, 17L, 2L)], width = 1496) }) - expect_snapshot({ options(width = 31); colonnade(df_str[c(45L, 14L, 49L, 24L, 22L, 31L, 42L, 18L, 16L, 47L, 25L, 4L, 37L, 8L, 26L, 21L, 50L, 5L, 41L, 30L, 2L, 33L, 34L, 3L, 44L, 19L, 43L, 6L, 32L, 29L, 20L, 1L, 13L, 11L, 40L, 12L, 48L, 23L, 9L, 15L, 46L, 36L, 27L, 35L, 28L, 10L, 7L, 39L, 17L, 38L)], width = 493) }) - expect_snapshot({ options(width = 52); colonnade(df_str[c(38L, 46L, 17L, 11L, 24L, 18L, 16L, 39L, 50L, 42L, 6L, 13L, 37L, 29L, 41L, 47L, 9L, 33L, 44L, 31L, 45L, 36L, 28L, 5L, 10L, 30L, 20L, 1L, 14L, 43L, 49L, 23L, 26L, 21L, 32L, 19L, 34L, 15L, 48L, 4L, 7L, 35L, 40L, 8L, 22L, 3L, 25L, 12L, 27L, 2L)], width = 1130) }) - expect_snapshot({ options(width = 58); colonnade(df_str[c(17L, 28L, 29L, 27L, 20L, 31L, 43L, 30L, 32L, 48L, 10L, 50L, 13L, 12L, 36L, 21L, 46L, 33L, 25L, 35L, 1L, 5L, 16L, 34L, 18L, 42L, 3L, 11L, 40L, 26L, 37L, 7L, 39L, 6L, 4L, 19L, 8L, 45L, 14L, 24L, 23L, 2L, 47L, 9L, 49L, 41L, 38L, 22L, 44L, 15L)], width = 1310) }) - expect_snapshot({ options(width = 47); colonnade(df_str[c(1L, 26L, 20L, 12L, 49L, 16L, 24L, 4L, 15L, 47L, 8L, 11L, 14L, 50L, 17L, 2L, 44L, 30L, 36L, 45L, 25L, 38L, 18L, 29L, 5L, 13L, 3L, 23L, 48L, 40L, 34L, 22L, 39L, 33L, 27L, 7L, 19L, 10L, 37L, 6L, 35L, 46L, 31L, 41L, 43L, 28L, 42L, 32L, 21L, 9L)], width = 484) }) - expect_snapshot({ options(width = 55); colonnade(df_str[c(6L, 49L, 26L, 45L, 25L, 15L, 31L, 20L, 21L, 44L, 23L, 48L, 37L, 36L, 5L, 43L, 11L, 14L, 13L, 39L, 16L, 12L, 4L, 18L, 42L, 3L, 10L, 28L, 40L, 24L, 29L, 17L, 35L, 47L, 2L, 38L, 34L, 9L, 7L, 8L, 50L, 33L, 32L, 27L, 46L, 19L, 22L, 41L, 30L, 1L)], width = 779) }) - expect_snapshot({ options(width = 46); colonnade(df_str[c(38L, 42L, 41L, 10L, 40L, 11L, 27L, 9L, 17L, 37L, 46L, 13L, 36L, 18L, 31L, 20L, 39L, 12L, 44L, 33L, 50L, 34L, 26L, 32L, 23L, 30L, 29L, 21L, 4L, 49L, 19L, 25L, 3L, 6L, 15L, 14L, 43L, 48L, 8L, 22L, 1L, 2L, 45L, 35L, 16L, 5L, 47L, 28L, 24L, 7L)], width = 694) }) + expect_snapshot({ + options(width = 59) + colonnade(df_str[c(12L, 33L, 36L, 7L, 41L, 3L, 18L, 23L, 13L, 44L, 14L, 16L, 25L, 21L, 19L, 45L, 43L, 29L, 1L, 30L, 22L, 27L, 15L, 47L, 28L, 31L, 10L, 50L, 4L, 40L, 42L, 8L, 6L, 9L, 24L, 48L, 38L, 37L, 34L, 49L, 46L, 2L, 32L, 35L, 39L, 11L, 17L, 5L, 26L, 20L)], width = 1382) + }) + expect_snapshot({ + options(width = 54) + colonnade(df_str[c(40L, 28L, 7L, 16L, 48L, 6L, 21L, 1L, 20L, 17L, 47L, 45L, 29L, 41L, 49L, 34L, 4L, 39L, 18L, 36L, 26L, 38L, 10L, 8L, 5L, 15L, 44L, 24L, 46L, 14L, 25L, 27L, 3L, 37L, 35L, 12L, 9L, 13L, 22L, 33L, 42L, 11L, 19L, 50L, 23L, 30L, 32L, 2L, 43L, 31L)], width = 837) + }) + expect_snapshot({ + options(width = 32) + colonnade(df_str[c(47L, 42L, 4L, 46L, 9L, 34L, 19L, 39L, 8L, 32L, 36L, 12L, 29L, 5L, 15L, 11L, 31L, 27L, 33L, 28L, 43L, 6L, 13L, 22L, 14L, 16L, 35L, 50L, 38L, 7L, 23L, 45L, 40L, 3L, 2L, 24L, 41L, 10L, 30L, 25L, 17L, 26L, 48L, 37L, 49L, 1L, 18L, 21L, 44L, 20L)], width = 455) + }) + expect_snapshot({ + options(width = 55) + colonnade(df_str[c(41L, 4L, 25L, 31L, 8L, 22L, 19L, 10L, 29L, 21L, 34L, 5L, 26L, 36L, 47L, 46L, 2L, 24L, 27L, 39L, 28L, 43L, 32L, 30L, 48L, 44L, 6L, 20L, 13L, 15L, 18L, 42L, 9L, 12L, 37L, 45L, 16L, 40L, 11L, 14L, 38L, 1L, 7L, 3L, 23L, 35L, 50L, 17L, 49L, 33L)], width = 855) + }) + expect_snapshot({ + options(width = 54) + colonnade(df_str[c(27L, 22L, 9L, 23L, 16L, 19L, 25L, 31L, 44L, 1L, 28L, 46L, 12L, 20L, 43L, 37L, 5L, 2L, 18L, 41L, 26L, 33L, 11L, 49L, 24L, 35L, 4L, 47L, 30L, 7L, 34L, 3L, 32L, 42L, 10L, 45L, 38L, 39L, 48L, 14L, 6L, 17L, 36L, 50L, 40L, 13L, 8L, 21L, 15L, 29L)], width = 552) + }) + expect_snapshot({ + options(width = 49) + colonnade(df_str[c(32L, 24L, 18L, 25L, 26L, 13L, 33L, 2L, 50L, 38L, 37L, 16L, 27L, 9L, 28L, 49L, 34L, 15L, 17L, 35L, 22L, 47L, 3L, 21L, 23L, 41L, 5L, 1L, 14L, 46L, 30L, 31L, 44L, 4L, 7L, 40L, 43L, 12L, 29L, 8L, 36L, 45L, 11L, 20L, 10L, 6L, 19L, 48L, 39L, 42L)], width = 1031) + }) + expect_snapshot({ + options(width = 38) + colonnade(df_str[c(44L, 34L, 49L, 9L, 15L, 16L, 1L, 10L, 40L, 29L, 26L, 22L, 4L, 43L, 20L, 17L, 46L, 33L, 35L, 32L, 2L, 12L, 8L, 37L, 23L, 39L, 7L, 18L, 36L, 42L, 6L, 30L, 19L, 25L, 5L, 21L, 47L, 50L, 28L, 11L, 31L, 14L, 24L, 27L, 45L, 41L, 38L, 3L, 13L, 48L)], width = 429) + }) + expect_snapshot({ + options(width = 54) + colonnade(df_str[c(21L, 26L, 8L, 22L, 41L, 24L, 13L, 5L, 47L, 37L, 4L, 42L, 19L, 34L, 11L, 43L, 38L, 3L, 33L, 20L, 31L, 2L, 18L, 48L, 27L, 44L, 9L, 35L, 30L, 6L, 49L, 10L, 1L, 16L, 46L, 29L, 12L, 14L, 45L, 36L, 15L, 39L, 50L, 23L, 17L, 28L, 7L, 32L, 40L, 25L)], width = 633) + }) + expect_snapshot({ + options(width = 39) + colonnade(df_str[c(23L, 49L, 13L, 37L, 3L, 25L, 36L, 4L, 9L, 7L, 27L, 48L, 12L, 10L, 50L, 14L, 38L, 39L, 46L, 22L, 28L, 8L, 21L, 44L, 32L, 40L, 31L, 1L, 29L, 34L, 35L, 33L, 19L, 15L, 41L, 20L, 47L, 18L, 16L, 45L, 6L, 5L, 24L, 26L, 43L, 11L, 42L, 30L, 17L, 2L)], width = 1496) + }) + expect_snapshot({ + options(width = 31) + colonnade(df_str[c(45L, 14L, 49L, 24L, 22L, 31L, 42L, 18L, 16L, 47L, 25L, 4L, 37L, 8L, 26L, 21L, 50L, 5L, 41L, 30L, 2L, 33L, 34L, 3L, 44L, 19L, 43L, 6L, 32L, 29L, 20L, 1L, 13L, 11L, 40L, 12L, 48L, 23L, 9L, 15L, 46L, 36L, 27L, 35L, 28L, 10L, 7L, 39L, 17L, 38L)], width = 493) + }) + expect_snapshot({ + options(width = 52) + colonnade(df_str[c(38L, 46L, 17L, 11L, 24L, 18L, 16L, 39L, 50L, 42L, 6L, 13L, 37L, 29L, 41L, 47L, 9L, 33L, 44L, 31L, 45L, 36L, 28L, 5L, 10L, 30L, 20L, 1L, 14L, 43L, 49L, 23L, 26L, 21L, 32L, 19L, 34L, 15L, 48L, 4L, 7L, 35L, 40L, 8L, 22L, 3L, 25L, 12L, 27L, 2L)], width = 1130) + }) + expect_snapshot({ + options(width = 58) + colonnade(df_str[c(17L, 28L, 29L, 27L, 20L, 31L, 43L, 30L, 32L, 48L, 10L, 50L, 13L, 12L, 36L, 21L, 46L, 33L, 25L, 35L, 1L, 5L, 16L, 34L, 18L, 42L, 3L, 11L, 40L, 26L, 37L, 7L, 39L, 6L, 4L, 19L, 8L, 45L, 14L, 24L, 23L, 2L, 47L, 9L, 49L, 41L, 38L, 22L, 44L, 15L)], width = 1310) + }) + expect_snapshot({ + options(width = 47) + colonnade(df_str[c(1L, 26L, 20L, 12L, 49L, 16L, 24L, 4L, 15L, 47L, 8L, 11L, 14L, 50L, 17L, 2L, 44L, 30L, 36L, 45L, 25L, 38L, 18L, 29L, 5L, 13L, 3L, 23L, 48L, 40L, 34L, 22L, 39L, 33L, 27L, 7L, 19L, 10L, 37L, 6L, 35L, 46L, 31L, 41L, 43L, 28L, 42L, 32L, 21L, 9L)], width = 484) + }) + expect_snapshot({ + options(width = 55) + colonnade(df_str[c(6L, 49L, 26L, 45L, 25L, 15L, 31L, 20L, 21L, 44L, 23L, 48L, 37L, 36L, 5L, 43L, 11L, 14L, 13L, 39L, 16L, 12L, 4L, 18L, 42L, 3L, 10L, 28L, 40L, 24L, 29L, 17L, 35L, 47L, 2L, 38L, 34L, 9L, 7L, 8L, 50L, 33L, 32L, 27L, 46L, 19L, 22L, 41L, 30L, 1L)], width = 779) + }) + expect_snapshot({ + options(width = 46) + colonnade(df_str[c(38L, 42L, 41L, 10L, 40L, 11L, 27L, 9L, 17L, 37L, 46L, 13L, 36L, 18L, 31L, 20L, 39L, 12L, 44L, 33L, 50L, 34L, 26L, 32L, 23L, 30L, 29L, 21L, 4L, 49L, 19L, 25L, 3L, 6L, 15L, 14L, 43L, 48L, 8L, 22L, 1L, 2L, 45L, 35L, 16L, 5L, 47L, 28L, 24L, 7L)], width = 694) + }) }) diff --git a/tests/testthat/test-format_multi_fuzz_2.R b/tests/testthat/test-format_multi_fuzz_2.R index cda4e1ade..f165a9b6e 100644 --- a/tests/testthat/test-format_multi_fuzz_2.R +++ b/tests/testthat/test-format_multi_fuzz_2.R @@ -2,19 +2,64 @@ test_that("strings with varying widths", { local_options(width = 80) # Generated by data-raw/create-chr-tests.R - expect_snapshot({ options(width = 54); colonnade(df_str[c(28L, 34L, 16L, 29L, 47L, 25L, 42L, 27L, 44L, 20L, 14L, 36L, 43L, 41L, 26L, 45L, 22L, 9L, 13L, 32L, 31L, 12L, 19L, 48L, 49L, 35L, 3L, 11L, 23L, 24L, 40L, 15L, 38L, 10L, 46L, 5L, 50L, 18L, 21L, 6L, 30L, 2L, 7L, 1L, 4L, 8L, 17L, 33L, 39L, 37L)], width = 516) }) - expect_snapshot({ options(width = 42); colonnade(df_str[c(28L, 41L, 12L, 29L, 13L, 43L, 24L, 50L, 48L, 35L, 44L, 21L, 33L, 45L, 47L, 34L, 25L, 14L, 18L, 23L, 7L, 3L, 42L, 36L, 11L, 2L, 20L, 31L, 1L, 4L, 38L, 9L, 27L, 40L, 32L, 17L, 6L, 49L, 16L, 19L, 15L, 22L, 39L, 10L, 46L, 5L, 30L, 8L, 26L, 37L)], width = 1365) }) - expect_snapshot({ options(width = 39); colonnade(df_str[c(40L, 17L, 13L, 23L, 22L, 2L, 18L, 3L, 29L, 45L, 14L, 19L, 33L, 37L, 47L, 43L, 44L, 10L, 31L, 27L, 34L, 35L, 41L, 21L, 4L, 25L, 38L, 48L, 9L, 24L, 26L, 39L, 20L, 36L, 42L, 16L, 6L, 11L, 7L, 12L, 1L, 46L, 15L, 5L, 8L, 50L, 32L, 30L, 49L, 28L)], width = 934) }) - expect_snapshot({ options(width = 32); colonnade(df_str[c(11L, 36L, 17L, 14L, 31L, 35L, 23L, 13L, 6L, 44L, 45L, 22L, 21L, 18L, 33L, 10L, 43L, 2L, 46L, 34L, 3L, 19L, 1L, 38L, 9L, 37L, 5L, 8L, 25L, 49L, 27L, 29L, 15L, 39L, 24L, 40L, 48L, 26L, 47L, 42L, 41L, 12L, 28L, 30L, 7L, 16L, 4L, 50L, 20L, 32L)], width = 565) }) - expect_snapshot({ options(width = 35); colonnade(df_str[c(18L, 46L, 11L, 43L, 31L, 47L, 48L, 44L, 50L, 15L, 28L, 33L, 13L, 4L, 22L, 3L, 37L, 32L, 40L, 9L, 25L, 16L, 45L, 23L, 21L, 6L, 49L, 36L, 27L, 38L, 14L, 34L, 8L, 24L, 29L, 1L, 12L, 2L, 20L, 17L, 35L, 5L, 19L, 30L, 7L, 26L, 42L, 41L, 39L, 10L)], width = 1121) }) - expect_snapshot({ options(width = 32); colonnade(df_str[c(43L, 1L, 3L, 15L, 28L, 12L, 46L, 34L, 31L, 7L, 11L, 4L, 44L, 8L, 9L, 5L, 36L, 22L, 17L, 39L, 18L, 45L, 37L, 13L, 29L, 6L, 30L, 16L, 20L, 10L, 19L, 26L, 33L, 40L, 35L, 48L, 38L, 25L, 2L, 47L, 42L, 41L, 27L, 14L, 21L, 24L, 50L, 49L, 23L, 32L)], width = 446) }) - expect_snapshot({ options(width = 31); colonnade(df_str[c(37L, 46L, 21L, 3L, 16L, 39L, 34L, 33L, 10L, 17L, 19L, 36L, 45L, 49L, 11L, 50L, 14L, 29L, 44L, 13L, 30L, 38L, 32L, 40L, 42L, 1L, 31L, 41L, 7L, 23L, 35L, 28L, 6L, 25L, 2L, 9L, 12L, 15L, 5L, 18L, 20L, 27L, 43L, 8L, 47L, 4L, 48L, 24L, 26L, 22L)], width = 1166) }) - expect_snapshot({ options(width = 58); colonnade(df_str[c(31L, 39L, 40L, 30L, 10L, 21L, 9L, 16L, 46L, 25L, 15L, 24L, 3L, 50L, 35L, 1L, 12L, 34L, 48L, 4L, 29L, 23L, 37L, 36L, 28L, 43L, 11L, 17L, 32L, 8L, 41L, 13L, 44L, 7L, 38L, 26L, 33L, 20L, 19L, 2L, 18L, 49L, 27L, 47L, 22L, 14L, 6L, 5L, 45L, 42L)], width = 546) }) - expect_snapshot({ options(width = 57); colonnade(df_str[c(43L, 21L, 41L, 48L, 22L, 25L, 2L, 8L, 1L, 24L, 6L, 39L, 38L, 20L, 49L, 45L, 47L, 12L, 9L, 13L, 36L, 26L, 44L, 11L, 46L, 28L, 7L, 18L, 50L, 16L, 29L, 30L, 4L, 23L, 17L, 40L, 33L, 14L, 27L, 19L, 34L, 32L, 3L, 37L, 15L, 10L, 5L, 35L, 31L, 42L)], width = 1035) }) - expect_snapshot({ options(width = 33); colonnade(df_str[c(40L, 6L, 25L, 5L, 26L, 17L, 19L, 2L, 11L, 34L, 45L, 24L, 22L, 44L, 35L, 7L, 4L, 49L, 1L, 36L, 12L, 41L, 39L, 13L, 48L, 27L, 18L, 30L, 42L, 28L, 3L, 46L, 21L, 20L, 16L, 29L, 50L, 10L, 9L, 8L, 47L, 31L, 14L, 38L, 33L, 32L, 43L, 23L, 15L, 37L)], width = 1217) }) - expect_snapshot({ options(width = 32); colonnade(df_str[c(43L, 23L, 22L, 11L, 6L, 26L, 48L, 17L, 7L, 42L, 36L, 21L, 35L, 50L, 13L, 19L, 29L, 8L, 15L, 4L, 2L, 27L, 49L, 47L, 30L, 31L, 25L, 28L, 46L, 12L, 32L, 39L, 24L, 10L, 45L, 5L, 37L, 14L, 40L, 20L, 41L, 44L, 33L, 18L, 38L, 3L, 1L, 34L, 16L, 9L)], width = 770) }) - expect_snapshot({ options(width = 46); colonnade(df_str[c(5L, 24L, 43L, 46L, 35L, 39L, 18L, 26L, 8L, 27L, 2L, 50L, 6L, 14L, 29L, 47L, 9L, 16L, 36L, 4L, 13L, 41L, 3L, 28L, 37L, 33L, 38L, 31L, 34L, 19L, 42L, 32L, 1L, 45L, 15L, 7L, 11L, 49L, 23L, 12L, 48L, 20L, 21L, 44L, 25L, 10L, 22L, 30L, 40L, 17L)], width = 1439) }) - expect_snapshot({ options(width = 52); colonnade(df_str[c(7L, 44L, 19L, 21L, 18L, 35L, 23L, 50L, 33L, 37L, 25L, 26L, 10L, 39L, 2L, 47L, 42L, 14L, 9L, 41L, 45L, 6L, 4L, 11L, 24L, 43L, 32L, 3L, 38L, 5L, 49L, 27L, 17L, 8L, 22L, 40L, 12L, 15L, 1L, 28L, 31L, 29L, 13L, 48L, 34L, 36L, 30L, 20L, 16L, 46L)], width = 1065) }) - expect_snapshot({ options(width = 35); colonnade(df_str[c(38L, 18L, 23L, 36L, 35L, 20L, 44L, 19L, 13L, 41L, 31L, 7L, 11L, 29L, 2L, 14L, 26L, 46L, 40L, 45L, 9L, 34L, 33L, 22L, 1L, 17L, 28L, 10L, 21L, 30L, 47L, 49L, 6L, 12L, 4L, 25L, 32L, 15L, 43L, 24L, 48L, 3L, 37L, 50L, 42L, 39L, 16L, 8L, 27L, 5L)], width = 393) }) - expect_snapshot({ options(width = 41); colonnade(df_str[c(22L, 9L, 11L, 26L, 19L, 16L, 32L, 25L, 1L, 30L, 31L, 6L, 24L, 10L, 39L, 21L, 50L, 7L, 29L, 12L, 46L, 43L, 15L, 35L, 20L, 40L, 49L, 38L, 36L, 48L, 34L, 3L, 8L, 4L, 27L, 42L, 44L, 33L, 45L, 18L, 5L, 2L, 13L, 47L, 28L, 17L, 37L, 14L, 41L, 23L)], width = 999) }) + expect_snapshot({ + options(width = 54) + colonnade(df_str[c(28L, 34L, 16L, 29L, 47L, 25L, 42L, 27L, 44L, 20L, 14L, 36L, 43L, 41L, 26L, 45L, 22L, 9L, 13L, 32L, 31L, 12L, 19L, 48L, 49L, 35L, 3L, 11L, 23L, 24L, 40L, 15L, 38L, 10L, 46L, 5L, 50L, 18L, 21L, 6L, 30L, 2L, 7L, 1L, 4L, 8L, 17L, 33L, 39L, 37L)], width = 516) + }) + expect_snapshot({ + options(width = 42) + colonnade(df_str[c(28L, 41L, 12L, 29L, 13L, 43L, 24L, 50L, 48L, 35L, 44L, 21L, 33L, 45L, 47L, 34L, 25L, 14L, 18L, 23L, 7L, 3L, 42L, 36L, 11L, 2L, 20L, 31L, 1L, 4L, 38L, 9L, 27L, 40L, 32L, 17L, 6L, 49L, 16L, 19L, 15L, 22L, 39L, 10L, 46L, 5L, 30L, 8L, 26L, 37L)], width = 1365) + }) + expect_snapshot({ + options(width = 39) + colonnade(df_str[c(40L, 17L, 13L, 23L, 22L, 2L, 18L, 3L, 29L, 45L, 14L, 19L, 33L, 37L, 47L, 43L, 44L, 10L, 31L, 27L, 34L, 35L, 41L, 21L, 4L, 25L, 38L, 48L, 9L, 24L, 26L, 39L, 20L, 36L, 42L, 16L, 6L, 11L, 7L, 12L, 1L, 46L, 15L, 5L, 8L, 50L, 32L, 30L, 49L, 28L)], width = 934) + }) + expect_snapshot({ + options(width = 32) + colonnade(df_str[c(11L, 36L, 17L, 14L, 31L, 35L, 23L, 13L, 6L, 44L, 45L, 22L, 21L, 18L, 33L, 10L, 43L, 2L, 46L, 34L, 3L, 19L, 1L, 38L, 9L, 37L, 5L, 8L, 25L, 49L, 27L, 29L, 15L, 39L, 24L, 40L, 48L, 26L, 47L, 42L, 41L, 12L, 28L, 30L, 7L, 16L, 4L, 50L, 20L, 32L)], width = 565) + }) + expect_snapshot({ + options(width = 35) + colonnade(df_str[c(18L, 46L, 11L, 43L, 31L, 47L, 48L, 44L, 50L, 15L, 28L, 33L, 13L, 4L, 22L, 3L, 37L, 32L, 40L, 9L, 25L, 16L, 45L, 23L, 21L, 6L, 49L, 36L, 27L, 38L, 14L, 34L, 8L, 24L, 29L, 1L, 12L, 2L, 20L, 17L, 35L, 5L, 19L, 30L, 7L, 26L, 42L, 41L, 39L, 10L)], width = 1121) + }) + expect_snapshot({ + options(width = 32) + colonnade(df_str[c(43L, 1L, 3L, 15L, 28L, 12L, 46L, 34L, 31L, 7L, 11L, 4L, 44L, 8L, 9L, 5L, 36L, 22L, 17L, 39L, 18L, 45L, 37L, 13L, 29L, 6L, 30L, 16L, 20L, 10L, 19L, 26L, 33L, 40L, 35L, 48L, 38L, 25L, 2L, 47L, 42L, 41L, 27L, 14L, 21L, 24L, 50L, 49L, 23L, 32L)], width = 446) + }) + expect_snapshot({ + options(width = 31) + colonnade(df_str[c(37L, 46L, 21L, 3L, 16L, 39L, 34L, 33L, 10L, 17L, 19L, 36L, 45L, 49L, 11L, 50L, 14L, 29L, 44L, 13L, 30L, 38L, 32L, 40L, 42L, 1L, 31L, 41L, 7L, 23L, 35L, 28L, 6L, 25L, 2L, 9L, 12L, 15L, 5L, 18L, 20L, 27L, 43L, 8L, 47L, 4L, 48L, 24L, 26L, 22L)], width = 1166) + }) + expect_snapshot({ + options(width = 58) + colonnade(df_str[c(31L, 39L, 40L, 30L, 10L, 21L, 9L, 16L, 46L, 25L, 15L, 24L, 3L, 50L, 35L, 1L, 12L, 34L, 48L, 4L, 29L, 23L, 37L, 36L, 28L, 43L, 11L, 17L, 32L, 8L, 41L, 13L, 44L, 7L, 38L, 26L, 33L, 20L, 19L, 2L, 18L, 49L, 27L, 47L, 22L, 14L, 6L, 5L, 45L, 42L)], width = 546) + }) + expect_snapshot({ + options(width = 57) + colonnade(df_str[c(43L, 21L, 41L, 48L, 22L, 25L, 2L, 8L, 1L, 24L, 6L, 39L, 38L, 20L, 49L, 45L, 47L, 12L, 9L, 13L, 36L, 26L, 44L, 11L, 46L, 28L, 7L, 18L, 50L, 16L, 29L, 30L, 4L, 23L, 17L, 40L, 33L, 14L, 27L, 19L, 34L, 32L, 3L, 37L, 15L, 10L, 5L, 35L, 31L, 42L)], width = 1035) + }) + expect_snapshot({ + options(width = 33) + colonnade(df_str[c(40L, 6L, 25L, 5L, 26L, 17L, 19L, 2L, 11L, 34L, 45L, 24L, 22L, 44L, 35L, 7L, 4L, 49L, 1L, 36L, 12L, 41L, 39L, 13L, 48L, 27L, 18L, 30L, 42L, 28L, 3L, 46L, 21L, 20L, 16L, 29L, 50L, 10L, 9L, 8L, 47L, 31L, 14L, 38L, 33L, 32L, 43L, 23L, 15L, 37L)], width = 1217) + }) + expect_snapshot({ + options(width = 32) + colonnade(df_str[c(43L, 23L, 22L, 11L, 6L, 26L, 48L, 17L, 7L, 42L, 36L, 21L, 35L, 50L, 13L, 19L, 29L, 8L, 15L, 4L, 2L, 27L, 49L, 47L, 30L, 31L, 25L, 28L, 46L, 12L, 32L, 39L, 24L, 10L, 45L, 5L, 37L, 14L, 40L, 20L, 41L, 44L, 33L, 18L, 38L, 3L, 1L, 34L, 16L, 9L)], width = 770) + }) + expect_snapshot({ + options(width = 46) + colonnade(df_str[c(5L, 24L, 43L, 46L, 35L, 39L, 18L, 26L, 8L, 27L, 2L, 50L, 6L, 14L, 29L, 47L, 9L, 16L, 36L, 4L, 13L, 41L, 3L, 28L, 37L, 33L, 38L, 31L, 34L, 19L, 42L, 32L, 1L, 45L, 15L, 7L, 11L, 49L, 23L, 12L, 48L, 20L, 21L, 44L, 25L, 10L, 22L, 30L, 40L, 17L)], width = 1439) + }) + expect_snapshot({ + options(width = 52) + colonnade(df_str[c(7L, 44L, 19L, 21L, 18L, 35L, 23L, 50L, 33L, 37L, 25L, 26L, 10L, 39L, 2L, 47L, 42L, 14L, 9L, 41L, 45L, 6L, 4L, 11L, 24L, 43L, 32L, 3L, 38L, 5L, 49L, 27L, 17L, 8L, 22L, 40L, 12L, 15L, 1L, 28L, 31L, 29L, 13L, 48L, 34L, 36L, 30L, 20L, 16L, 46L)], width = 1065) + }) + expect_snapshot({ + options(width = 35) + colonnade(df_str[c(38L, 18L, 23L, 36L, 35L, 20L, 44L, 19L, 13L, 41L, 31L, 7L, 11L, 29L, 2L, 14L, 26L, 46L, 40L, 45L, 9L, 34L, 33L, 22L, 1L, 17L, 28L, 10L, 21L, 30L, 47L, 49L, 6L, 12L, 4L, 25L, 32L, 15L, 43L, 24L, 48L, 3L, 37L, 50L, 42L, 39L, 16L, 8L, 27L, 5L)], width = 393) + }) + expect_snapshot({ + options(width = 41) + colonnade(df_str[c(22L, 9L, 11L, 26L, 19L, 16L, 32L, 25L, 1L, 30L, 31L, 6L, 24L, 10L, 39L, 21L, 50L, 7L, 29L, 12L, 46L, 43L, 15L, 35L, 20L, 40L, 49L, 38L, 36L, 48L, 34L, 3L, 8L, 4L, 27L, 42L, 44L, 33L, 45L, 18L, 5L, 2L, 13L, 47L, 28L, 17L, 37L, 14L, 41L, 23L)], width = 999) + }) }) diff --git a/tests/testthat/test-obj-sum.R b/tests/testthat/test-obj-sum.R index ff78fddd8..db3869a7c 100644 --- a/tests/testthat/test-obj-sum.R +++ b/tests/testthat/test-obj-sum.R @@ -19,7 +19,7 @@ test_that("data frames and common data vectors have size summary", { obj_sum <- obj_sum(x) ptype <- type_sum(x) - expect_equal(obj_sum, !! paste_with_space_if_needed(ptype, size_sum(x))) + expect_equal(obj_sum, !!paste_with_space_if_needed(ptype, size_sum(x))) } expect_obj_sum_is_ptype(mtcars) diff --git a/tests/testthat/test-tbl-format-body.R b/tests/testthat/test-tbl-format-body.R index 9155fcc80..5397fffe3 100644 --- a/tests/testthat/test-tbl-format-body.R +++ b/tests/testthat/test-tbl-format-body.R @@ -22,7 +22,7 @@ test_that("tbl_format_body() results", { test_that("body: output for wide characters", { skip_if(!l10n_info()$`UTF-8`) - if(getRversion() == "4.0.4") { + if (getRversion() == "4.0.4") { # This seems to show differently on the Mac: # writeLines(evaluate::evaluate('c("\\u6210", "\\u6210")')[[1]]$src) skip_on_os("mac")