From 19cf68b07d777ee57fd4a4c2b2fe16c5401d69f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Thu, 23 Mar 2023 08:48:52 +0100 Subject: [PATCH] Clean up tests --- tests/testthat/test-aaa-options.R | 7 + tests/testthat/test-capital.R | 25 ++ tests/testthat/test-char.R | 79 +++++ tests/testthat/test-compat-lifecycle.R | 70 ++++ tests/testthat/test-compat-purrr.R | 358 +++++++++++++++++++++ tests/testthat/test-continuation-data.R | 16 + tests/testthat/test-ctl_colonnade.R | 146 +++++++++ tests/testthat/test-ctl_new_pillar.R | 29 ++ tests/testthat/test-ctl_new_pillar_list.R | 70 ++++ tests/testthat/test-ctl_pillar.R | 43 +++ tests/testthat/test-ctl_pillar_component.R | 43 +++ tests/testthat/test-deprecated.R | 7 + tests/testthat/test-dim.R | 47 +++ tests/testthat/test-empty-data.R | 16 + tests/testthat/test-extent.R | 34 ++ tests/testthat/test-ggplot2.R | 47 +++ tests/testthat/test-glimpse.R | 38 +++ tests/testthat/test-multi.R | 245 ++++++++++++++ tests/testthat/test-num.R | 119 +++++++ tests/testthat/test-options.R | 56 ++++ tests/testthat/test-ornament.R | 29 ++ tests/testthat/test-pillar-package.R | 1 + tests/testthat/test-pillar.R | 70 ++++ tests/testthat/test-pluralise.R | 16 + tests/testthat/test-register-s3.R | 16 + tests/testthat/test-rowid-capital.R | 7 + tests/testthat/test-rowid-data.R | 25 ++ tests/testthat/test-rowid-title.R | 16 + tests/testthat/test-rowid-type.R | 25 ++ tests/testthat/test-scientific.R | 25 ++ tests/testthat/test-shaft-.R | 65 ++++ tests/testthat/test-shaft-simple.R | 16 + tests/testthat/test-show_source.R | 25 ++ tests/testthat/test-sigfig.R | 178 ++++++++++ tests/testthat/test-strrep.R | 7 + tests/testthat/test-styles.R | 133 ++++++++ tests/testthat/test-tbl-format-body.R | 11 + tests/testthat/test-tbl-format-footer.R | 128 ++++++++ tests/testthat/test-tbl-format-header.R | 11 + tests/testthat/test-tbl-format-setup.R | 56 ++++ tests/testthat/test-tbl-format.R | 65 ++++ tests/testthat/test-tbl-sum.R | 7 + tests/testthat/test-tbl.R | 25 ++ tests/testthat/test-testthat.R | 7 + tests/testthat/test-tick.R | 52 +++ tests/testthat/test-title.R | 29 ++ tests/testthat/test-type-sum.R | 34 ++ tests/testthat/test-type.R | 70 ++++ tests/testthat/test-utils.R | 178 ++++++++++ tests/testthat/test-vctr.R | 74 +++++ tests/testthat/test-vctrs.R | 16 + tests/testthat/test-width.R | 52 +++ tests/testthat/test-zzz.R | 70 ++++ 53 files changed, 3034 insertions(+) create mode 100644 tests/testthat/test-aaa-options.R create mode 100644 tests/testthat/test-capital.R create mode 100644 tests/testthat/test-char.R create mode 100644 tests/testthat/test-compat-lifecycle.R create mode 100644 tests/testthat/test-compat-purrr.R create mode 100644 tests/testthat/test-continuation-data.R create mode 100644 tests/testthat/test-ctl_new_pillar_list.R create mode 100644 tests/testthat/test-ctl_pillar.R create mode 100644 tests/testthat/test-ctl_pillar_component.R create mode 100644 tests/testthat/test-deprecated.R create mode 100644 tests/testthat/test-empty-data.R create mode 100644 tests/testthat/test-extent.R create mode 100644 tests/testthat/test-pillar-package.R create mode 100644 tests/testthat/test-pillar.R create mode 100644 tests/testthat/test-pluralise.R create mode 100644 tests/testthat/test-register-s3.R create mode 100644 tests/testthat/test-rowid-capital.R create mode 100644 tests/testthat/test-rowid-data.R create mode 100644 tests/testthat/test-rowid-title.R create mode 100644 tests/testthat/test-rowid-type.R create mode 100644 tests/testthat/test-scientific.R create mode 100644 tests/testthat/test-shaft-simple.R create mode 100644 tests/testthat/test-show_source.R create mode 100644 tests/testthat/test-sigfig.R create mode 100644 tests/testthat/test-strrep.R create mode 100644 tests/testthat/test-styles.R create mode 100644 tests/testthat/test-tbl-sum.R create mode 100644 tests/testthat/test-tbl.R create mode 100644 tests/testthat/test-testthat.R create mode 100644 tests/testthat/test-tick.R create mode 100644 tests/testthat/test-type-sum.R create mode 100644 tests/testthat/test-type.R create mode 100644 tests/testthat/test-utils.R create mode 100644 tests/testthat/test-vctrs.R create mode 100644 tests/testthat/test-width.R create mode 100644 tests/testthat/test-zzz.R diff --git a/tests/testthat/test-aaa-options.R b/tests/testthat/test-aaa-options.R new file mode 100644 index 000000000..7706cf40b --- /dev/null +++ b/tests/testthat/test-aaa-options.R @@ -0,0 +1,7 @@ +# make_option_impl -------------------------------------------------------------------- + +test_that("`make_option_impl()` snapshot test", { + expect_snapshot({ + make_option_impl() + }) +}) diff --git a/tests/testthat/test-capital.R b/tests/testthat/test-capital.R new file mode 100644 index 000000000..6a6960912 --- /dev/null +++ b/tests/testthat/test-capital.R @@ -0,0 +1,25 @@ +# pillar_capital ---------------------------------------------------------------------- + +test_that("`pillar_capital()` snapshot test", { + expect_snapshot({ + pillar_capital() + }) +}) + + +# new_pillar_capital ------------------------------------------------------------------ + +test_that("`new_pillar_capital()` snapshot test", { + expect_snapshot({ + new_pillar_capital() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) diff --git a/tests/testthat/test-char.R b/tests/testthat/test-char.R new file mode 100644 index 000000000..da5156202 --- /dev/null +++ b/tests/testthat/test-char.R @@ -0,0 +1,79 @@ +# char -------------------------------------------------------------------------------- + +test_that("`char()` snapshot test", { + expect_snapshot({ + char() + }) +}) + + +# vec_ptype_full ---------------------------------------------------------------------- + +test_that("`vec_ptype_full()` snapshot test", { + expect_snapshot({ + vec_ptype_full() + }) +}) + + +# vec_ptype_abbr ---------------------------------------------------------------------- + +test_that("`vec_ptype_abbr()` snapshot test", { + expect_snapshot({ + vec_ptype_abbr() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# set_char_opts ----------------------------------------------------------------------- + +test_that("`set_char_opts()` snapshot test", { + expect_snapshot({ + set_char_opts() + }) +}) + + +# vec_ptype2.pillar_char -------------------------------------------------------------- + +test_that("`vec_ptype2.pillar_char()` snapshot test", { + expect_snapshot({ + vec_ptype2.pillar_char() + }) +}) + + +# vec_ptype2.character ---------------------------------------------------------------- + +test_that("`vec_ptype2.character()` snapshot test", { + expect_snapshot({ + vec_ptype2.character() + }) +}) + + +# vec_cast.pillar_char ---------------------------------------------------------------- + +test_that("`vec_cast.pillar_char()` snapshot test", { + expect_snapshot({ + vec_cast.pillar_char() + }) +}) + + +# vec_cast.character ------------------------------------------------------------------ + +test_that("`vec_cast.character()` snapshot test", { + expect_snapshot({ + vec_cast.character() + }) +}) diff --git a/tests/testthat/test-compat-lifecycle.R b/tests/testthat/test-compat-lifecycle.R new file mode 100644 index 000000000..becb7a886 --- /dev/null +++ b/tests/testthat/test-compat-lifecycle.R @@ -0,0 +1,70 @@ +# scoped_lifecycle_silence ------------------------------------------------------------ + +test_that("`scoped_lifecycle_silence()` snapshot test", { + expect_snapshot({ + scoped_lifecycle_silence() + }) +}) + + +# with_lifecycle_silence -------------------------------------------------------------- + +test_that("`with_lifecycle_silence()` snapshot test", { + expect_snapshot({ + with_lifecycle_silence() + }) +}) + + +# scoped_lifecycle_warnings ----------------------------------------------------------- + +test_that("`scoped_lifecycle_warnings()` snapshot test", { + expect_snapshot({ + scoped_lifecycle_warnings() + }) +}) + + +# with_lifecycle_warnings ------------------------------------------------------------- + +test_that("`with_lifecycle_warnings()` snapshot test", { + expect_snapshot({ + with_lifecycle_warnings() + }) +}) + + +# scoped_lifecycle_errors ------------------------------------------------------------- + +test_that("`scoped_lifecycle_errors()` snapshot test", { + expect_snapshot({ + scoped_lifecycle_errors() + }) +}) + + +# with_lifecycle_errors --------------------------------------------------------------- + +test_that("`with_lifecycle_errors()` snapshot test", { + expect_snapshot({ + with_lifecycle_errors() + }) +}) + + +# signal_superseded ------------------------------------------------------------------- + +test_that("`signal_superseded()` snapshot test", { + expect_snapshot({ + signal_superseded() + }) +}) + + +# foreign_caller_env ------------------------------------------------------------------ + +test_that("`foreign_caller_env()` snapshot test", { + expect_snapshot({ + foreign_caller_env() + }) +}) diff --git a/tests/testthat/test-compat-purrr.R b/tests/testthat/test-compat-purrr.R new file mode 100644 index 000000000..60a3b864d --- /dev/null +++ b/tests/testthat/test-compat-purrr.R @@ -0,0 +1,358 @@ +# map --------------------------------------------------------------------------------- + +test_that("`map()` snapshot test", { + expect_snapshot({ + map() + }) +}) + + +# map_mold ---------------------------------------------------------------------------- + +test_that("`map_mold()` snapshot test", { + expect_snapshot({ + map_mold() + }) +}) + + +# map_lgl ----------------------------------------------------------------------------- + +test_that("`map_lgl()` snapshot test", { + expect_snapshot({ + map_lgl() + }) +}) + + +# map_int ----------------------------------------------------------------------------- + +test_that("`map_int()` snapshot test", { + expect_snapshot({ + map_int() + }) +}) + + +# map_dbl ----------------------------------------------------------------------------- + +test_that("`map_dbl()` snapshot test", { + expect_snapshot({ + map_dbl() + }) +}) + + +# map_chr ----------------------------------------------------------------------------- + +test_that("`map_chr()` snapshot test", { + expect_snapshot({ + map_chr() + }) +}) + + +# map_cpl ----------------------------------------------------------------------------- + +test_that("`map_cpl()` snapshot test", { + expect_snapshot({ + map_cpl() + }) +}) + + +# walk -------------------------------------------------------------------------------- + +test_that("`walk()` snapshot test", { + expect_snapshot({ + walk() + }) +}) + + +# pluck ------------------------------------------------------------------------------- + +test_that("`pluck()` snapshot test", { + expect_snapshot({ + pluck() + }) +}) + + +# pluck_lgl --------------------------------------------------------------------------- + +test_that("`pluck_lgl()` snapshot test", { + expect_snapshot({ + pluck_lgl() + }) +}) + + +# pluck_int --------------------------------------------------------------------------- + +test_that("`pluck_int()` snapshot test", { + expect_snapshot({ + pluck_int() + }) +}) + + +# pluck_dbl --------------------------------------------------------------------------- + +test_that("`pluck_dbl()` snapshot test", { + expect_snapshot({ + pluck_dbl() + }) +}) + + +# pluck_chr --------------------------------------------------------------------------- + +test_that("`pluck_chr()` snapshot test", { + expect_snapshot({ + pluck_chr() + }) +}) + + +# pluck_cpl --------------------------------------------------------------------------- + +test_that("`pluck_cpl()` snapshot test", { + expect_snapshot({ + pluck_cpl() + }) +}) + + +# map2 -------------------------------------------------------------------------------- + +test_that("`map2()` snapshot test", { + expect_snapshot({ + map2() + }) +}) + + +# map2_lgl ---------------------------------------------------------------------------- + +test_that("`map2_lgl()` snapshot test", { + expect_snapshot({ + map2_lgl() + }) +}) + + +# map2_int ---------------------------------------------------------------------------- + +test_that("`map2_int()` snapshot test", { + expect_snapshot({ + map2_int() + }) +}) + + +# map2_dbl ---------------------------------------------------------------------------- + +test_that("`map2_dbl()` snapshot test", { + expect_snapshot({ + map2_dbl() + }) +}) + + +# map2_chr ---------------------------------------------------------------------------- + +test_that("`map2_chr()` snapshot test", { + expect_snapshot({ + map2_chr() + }) +}) + + +# map2_cpl ---------------------------------------------------------------------------- + +test_that("`map2_cpl()` snapshot test", { + expect_snapshot({ + map2_cpl() + }) +}) + + +# args_recycle ------------------------------------------------------------------------ + +test_that("`args_recycle()` snapshot test", { + expect_snapshot({ + args_recycle() + }) +}) + + +# pmap -------------------------------------------------------------------------------- + +test_that("`pmap()` snapshot test", { + expect_snapshot({ + pmap() + }) +}) + + +# probe ------------------------------------------------------------------------------- + +test_that("`probe()` snapshot test", { + expect_snapshot({ + probe() + }) +}) + + +# keep -------------------------------------------------------------------------------- + +test_that("`keep()` snapshot test", { + expect_snapshot({ + keep() + }) +}) + + +# discard ----------------------------------------------------------------------------- + +test_that("`discard()` snapshot test", { + expect_snapshot({ + discard() + }) +}) + + +# map_if ------------------------------------------------------------------------------ + +test_that("`map_if()` snapshot test", { + expect_snapshot({ + map_if() + }) +}) + + +# compact ----------------------------------------------------------------------------- + +test_that("`compact()` snapshot test", { + expect_snapshot({ + compact() + }) +}) + + +# transpose --------------------------------------------------------------------------- + +test_that("`transpose()` snapshot test", { + expect_snapshot({ + transpose() + }) +}) + + +# every ------------------------------------------------------------------------------- + +test_that("`every()` snapshot test", { + expect_snapshot({ + every() + }) +}) + + +# some -------------------------------------------------------------------------------- + +test_that("`some()` snapshot test", { + expect_snapshot({ + some() + }) +}) + + +# negate ------------------------------------------------------------------------------ + +test_that("`negate()` snapshot test", { + expect_snapshot({ + negate() + }) +}) + + +# reduce ------------------------------------------------------------------------------ + +test_that("`reduce()` snapshot test", { + expect_snapshot({ + reduce() + }) +}) + + +# reduce_right ------------------------------------------------------------------------ + +test_that("`reduce_right()` snapshot test", { + expect_snapshot({ + reduce_right() + }) +}) + + +# accumulate -------------------------------------------------------------------------- + +test_that("`accumulate()` snapshot test", { + expect_snapshot({ + accumulate() + }) +}) + + +# accumulate_right -------------------------------------------------------------------- + +test_that("`accumulate_right()` snapshot test", { + expect_snapshot({ + accumulate_right() + }) +}) + + +# detect ------------------------------------------------------------------------------ + +test_that("`detect()` snapshot test", { + expect_snapshot({ + detect() + }) +}) + + +# detect_index ------------------------------------------------------------------------ + +test_that("`detect_index()` snapshot test", { + expect_snapshot({ + detect_index() + }) +}) + + +# index ------------------------------------------------------------------------------- + +test_that("`index()` snapshot test", { + expect_snapshot({ + index() + }) +}) + + +# imap -------------------------------------------------------------------------------- + +test_that("`imap()` snapshot test", { + expect_snapshot({ + imap() + }) +}) + + +# vec_index --------------------------------------------------------------------------- + +test_that("`vec_index()` snapshot test", { + expect_snapshot({ + vec_index() + }) +}) diff --git a/tests/testthat/test-continuation-data.R b/tests/testthat/test-continuation-data.R new file mode 100644 index 000000000..2a4db1322 --- /dev/null +++ b/tests/testthat/test-continuation-data.R @@ -0,0 +1,16 @@ +# new_continuation_shaft -------------------------------------------------------------- + +test_that("`new_continuation_shaft()` snapshot test", { + expect_snapshot({ + new_continuation_shaft() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) diff --git a/tests/testthat/test-ctl_colonnade.R b/tests/testthat/test-ctl_colonnade.R index 9db7b35ed..1b2e18cc7 100644 --- a/tests/testthat/test-ctl_colonnade.R +++ b/tests/testthat/test-ctl_colonnade.R @@ -1,3 +1,149 @@ +# ctl_colonnade ----------------------------------------------------------------------- + +test_that("`ctl_colonnade()` snapshot test", { + expect_snapshot({ + ctl_colonnade() + }) +}) + + +# new_emit_tiers_callbacks ------------------------------------------------------------ + +test_that("`new_emit_tiers_callbacks()` snapshot test", { + expect_snapshot({ + new_emit_tiers_callbacks() + }) +}) + + +# do_emit_tiers ----------------------------------------------------------------------- + +test_that("`do_emit_tiers()` snapshot test", { + expect_snapshot({ + do_emit_tiers() + }) +}) + + +# new_emit_pillars_callbacks ---------------------------------------------------------- + +test_that("`new_emit_pillars_callbacks()` snapshot test", { + expect_snapshot({ + new_emit_pillars_callbacks() + }) +}) + + +# emit_pillars ------------------------------------------------------------------------ + +test_that("`emit_pillars()` snapshot test", { + expect_snapshot({ + emit_pillars() + }) +}) + + +# do_emit_focus_pillars --------------------------------------------------------------- + +test_that("`do_emit_focus_pillars()` snapshot test", { + expect_snapshot({ + do_emit_focus_pillars() + }) +}) + + +# advance_emit_pillars ---------------------------------------------------------------- + +test_that("`advance_emit_pillars()` snapshot test", { + expect_snapshot({ + advance_emit_pillars() + }) +}) + + +# do_emit_pillars --------------------------------------------------------------------- + +test_that("`do_emit_pillars()` snapshot test", { + expect_snapshot({ + do_emit_pillars() + }) +}) + + +# compute_used_width ------------------------------------------------------------------ + +test_that("`compute_used_width()` snapshot test", { + expect_snapshot({ + compute_used_width() + }) +}) + + +# compute_sub_tier_widths ------------------------------------------------------------- + +test_that("`compute_sub_tier_widths()` snapshot test", { + expect_snapshot({ + compute_sub_tier_widths() + }) +}) + + +# advance_pos ------------------------------------------------------------------------- + +test_that("`advance_pos()` snapshot test", { + expect_snapshot({ + advance_pos() + }) +}) + + +# emit_extra_cols --------------------------------------------------------------------- + +test_that("`emit_extra_cols()` snapshot test", { + expect_snapshot({ + emit_extra_cols() + }) +}) + + +# fsi --------------------------------------------------------------------------------- + +test_that("`fsi()` snapshot test", { + expect_snapshot({ + fsi() + }) +}) + + +# lro --------------------------------------------------------------------------------- + +test_that("`lro()` snapshot test", { + expect_snapshot({ + lro() + }) +}) + + +# format_colonnade_tier_2 ------------------------------------------------------------- + +test_that("`format_colonnade_tier_2()` snapshot test", { + expect_snapshot({ + format_colonnade_tier_2() + }) +}) + + +# new_colonnade_body ------------------------------------------------------------------ + +test_that("`new_colonnade_body()` snapshot test", { + expect_snapshot({ + new_colonnade_body() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("output test", { expect_snapshot({ ctl_colonnade(rep(list(paste(letters, collapse = " ")), 4), width = Inf) diff --git a/tests/testthat/test-ctl_new_pillar.R b/tests/testthat/test-ctl_new_pillar.R index 1ae1a2fa4..8de0a8f2a 100644 --- a/tests/testthat/test-ctl_new_pillar.R +++ b/tests/testthat/test-ctl_new_pillar.R @@ -1,3 +1,32 @@ +# ctl_new_pillar ---------------------------------------------------------------------- + +test_that("`ctl_new_pillar()` snapshot test", { + expect_snapshot({ + ctl_new_pillar() + }) +}) + + +# ctl_new_rowid_pillar ---------------------------------------------------------------- + +test_that("`ctl_new_rowid_pillar()` snapshot test", { + expect_snapshot({ + ctl_new_rowid_pillar() + }) +}) + + +# max0 -------------------------------------------------------------------------------- + +test_that("`max0()` snapshot test", { + expect_snapshot({ + max0() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("ctl_new_pillar()", { expect_snapshot({ ctl_new_pillar(new_tbl(), 1:3, width = 20, title = "a") diff --git a/tests/testthat/test-ctl_new_pillar_list.R b/tests/testthat/test-ctl_new_pillar_list.R new file mode 100644 index 000000000..1d90b7ef8 --- /dev/null +++ b/tests/testthat/test-ctl_new_pillar_list.R @@ -0,0 +1,70 @@ +# ctl_new_pillar_list ----------------------------------------------------------------- + +test_that("`ctl_new_pillar_list()` snapshot test", { + expect_snapshot({ + ctl_new_pillar_list() + }) +}) + + +# new_data_frame_pillar_list ---------------------------------------------------------- + +test_that("`new_data_frame_pillar_list()` snapshot test", { + expect_snapshot({ + new_data_frame_pillar_list() + }) +}) + + +# new_matrix_pillar_list -------------------------------------------------------------- + +test_that("`new_matrix_pillar_list()` snapshot test", { + expect_snapshot({ + new_matrix_pillar_list() + }) +}) + + +# new_array_pillar_list --------------------------------------------------------------- + +test_that("`new_array_pillar_list()` snapshot test", { + expect_snapshot({ + new_array_pillar_list() + }) +}) + + +# deduct_width ------------------------------------------------------------------------ + +test_that("`deduct_width()` snapshot test", { + expect_snapshot({ + deduct_width() + }) +}) + + +# new_single_pillar_list -------------------------------------------------------------- + +test_that("`new_single_pillar_list()` snapshot test", { + expect_snapshot({ + new_single_pillar_list() + }) +}) + + +# new_pillar_list --------------------------------------------------------------------- + +test_that("`new_pillar_list()` snapshot test", { + expect_snapshot({ + new_pillar_list() + }) +}) + + +# prepare_title ----------------------------------------------------------------------- + +test_that("`prepare_title()` snapshot test", { + expect_snapshot({ + prepare_title() + }) +}) diff --git a/tests/testthat/test-ctl_pillar.R b/tests/testthat/test-ctl_pillar.R new file mode 100644 index 000000000..c002b39e0 --- /dev/null +++ b/tests/testthat/test-ctl_pillar.R @@ -0,0 +1,43 @@ +# pillar ------------------------------------------------------------------------------ + +test_that("`pillar()` snapshot test", { + expect_snapshot({ + pillar() + }) +}) + + +# pillar_from_shaft ------------------------------------------------------------------- + +test_that("`pillar_from_shaft()` snapshot test", { + expect_snapshot({ + pillar_from_shaft() + }) +}) + + +# new_pillar -------------------------------------------------------------------------- + +test_that("`new_pillar()` snapshot test", { + expect_snapshot({ + new_pillar() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# print ------------------------------------------------------------------------------- + +test_that("`print()` snapshot test", { + expect_snapshot({ + print() + }) +}) diff --git a/tests/testthat/test-ctl_pillar_component.R b/tests/testthat/test-ctl_pillar_component.R new file mode 100644 index 000000000..e36d32d7c --- /dev/null +++ b/tests/testthat/test-ctl_pillar_component.R @@ -0,0 +1,43 @@ +# new_pillar_component ---------------------------------------------------------------- + +test_that("`new_pillar_component()` snapshot test", { + expect_snapshot({ + new_pillar_component() + }) +}) + + +# pillar_component -------------------------------------------------------------------- + +test_that("`pillar_component()` snapshot test", { + expect_snapshot({ + pillar_component() + }) +}) + + +# pillar_get_width -------------------------------------------------------------------- + +test_that("`pillar_get_width()` snapshot test", { + expect_snapshot({ + pillar_get_width() + }) +}) + + +# pillar_get_min_width ---------------------------------------------------------------- + +test_that("`pillar_get_min_width()` snapshot test", { + expect_snapshot({ + pillar_get_min_width() + }) +}) + + +# pillar_format_parts_2 --------------------------------------------------------------- + +test_that("`pillar_format_parts_2()` snapshot test", { + expect_snapshot({ + pillar_format_parts_2() + }) +}) diff --git a/tests/testthat/test-deprecated.R b/tests/testthat/test-deprecated.R new file mode 100644 index 000000000..c177af113 --- /dev/null +++ b/tests/testthat/test-deprecated.R @@ -0,0 +1,7 @@ +# is_vector_s3 ------------------------------------------------------------------------ + +test_that("`is_vector_s3()` snapshot test", { + expect_snapshot({ + is_vector_s3() + }) +}) diff --git a/tests/testthat/test-dim.R b/tests/testthat/test-dim.R index 5d3ffba69..b1e27a80b 100644 --- a/tests/testthat/test-dim.R +++ b/tests/testthat/test-dim.R @@ -1,3 +1,50 @@ +# dim_desc ---------------------------------------------------------------------------- + +test_that("`dim_desc()` snapshot test", { + expect_snapshot({ + dim_desc() + }) +}) + + +# dim2 -------------------------------------------------------------------------------- + +test_that("`dim2()` snapshot test", { + expect_snapshot({ + dim2() + }) +}) + + +# mult_sign --------------------------------------------------------------------------- + +test_that("`mult_sign()` snapshot test", { + expect_snapshot({ + mult_sign() + }) +}) + + +# spaces_around ----------------------------------------------------------------------- + +test_that("`spaces_around()` snapshot test", { + expect_snapshot({ + spaces_around() + }) +}) + + +# big_mark ---------------------------------------------------------------------------- + +test_that("`big_mark()` snapshot test", { + expect_snapshot({ + big_mark() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("dim2() falls back to vec_size()", { expect_equal(dim2(1:3), 3) expect_equal(dim2(Titanic), dim(Titanic)) diff --git a/tests/testthat/test-empty-data.R b/tests/testthat/test-empty-data.R new file mode 100644 index 000000000..85f91c6f7 --- /dev/null +++ b/tests/testthat/test-empty-data.R @@ -0,0 +1,16 @@ +# style_empty ------------------------------------------------------------------------- + +test_that("`style_empty()` snapshot test", { + expect_snapshot({ + style_empty() + }) +}) + + +# new_empty_shaft --------------------------------------------------------------------- + +test_that("`new_empty_shaft()` snapshot test", { + expect_snapshot({ + new_empty_shaft() + }) +}) diff --git a/tests/testthat/test-extent.R b/tests/testthat/test-extent.R new file mode 100644 index 000000000..b60648959 --- /dev/null +++ b/tests/testthat/test-extent.R @@ -0,0 +1,34 @@ +# get_extent -------------------------------------------------------------------------- + +test_that("`get_extent()` snapshot test", { + expect_snapshot({ + get_extent() + }) +}) + + +# get_max_extent ---------------------------------------------------------------------- + +test_that("`get_max_extent()` snapshot test", { + expect_snapshot({ + get_max_extent() + }) +}) + + +# align ------------------------------------------------------------------------------- + +test_that("`align()` snapshot test", { + expect_snapshot({ + align() + }) +}) + + +# align_impl -------------------------------------------------------------------------- + +test_that("`align_impl()` snapshot test", { + expect_snapshot({ + align_impl() + }) +}) diff --git a/tests/testthat/test-ggplot2.R b/tests/testthat/test-ggplot2.R index 9c223847f..e830b7208 100644 --- a/tests/testthat/test-ggplot2.R +++ b/tests/testthat/test-ggplot2.R @@ -1,3 +1,50 @@ +# scale_x_num ------------------------------------------------------------------------- + +test_that("`scale_x_num()` snapshot test", { + expect_snapshot({ + scale_x_num() + }) +}) + + +# scale_y_num ------------------------------------------------------------------------- + +test_that("`scale_y_num()` snapshot test", { + expect_snapshot({ + scale_y_num() + }) +}) + + +# MakeScaleContinuousPositionNum ------------------------------------------------------ + +test_that("`MakeScaleContinuousPositionNum()` snapshot test", { + expect_snapshot({ + MakeScaleContinuousPositionNum() + }) +}) + + +# scale_type -------------------------------------------------------------------------- + +test_that("`scale_type()` snapshot test", { + expect_snapshot({ + scale_type() + }) +}) + + +# rescale ----------------------------------------------------------------------------- + +test_that("`rescale()` snapshot test", { + expect_snapshot({ + rescale() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("ggplot2 snapshot tests", { skip_if_not_installed("ggplot2") skip_if_not_installed("vdiffr") diff --git a/tests/testthat/test-glimpse.R b/tests/testthat/test-glimpse.R index accab0164..81c5adea4 100644 --- a/tests/testthat/test-glimpse.R +++ b/tests/testthat/test-glimpse.R @@ -1,3 +1,41 @@ +# glimpse ----------------------------------------------------------------------------- + +test_that("`glimpse()` snapshot test", { + expect_snapshot({ + glimpse() + }) +}) + + +# format_glimpse ---------------------------------------------------------------------- + +test_that("`format_glimpse()` snapshot test", { + expect_snapshot({ + format_glimpse() + }) +}) + + +# format_glimpse_1 -------------------------------------------------------------------- + +test_that("`format_glimpse_1()` snapshot test", { + expect_snapshot({ + format_glimpse_1() + }) +}) + + +# format_glimpse_ --------------------------------------------------------------------- + +test_that("`format_glimpse_()` snapshot test", { + expect_snapshot({ + format_glimpse_() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("format_glimpse() output test", { expect_snapshot({ "# Atomic numbers" diff --git a/tests/testthat/test-multi.R b/tests/testthat/test-multi.R index 2be5f186e..1cce4a704 100644 --- a/tests/testthat/test-multi.R +++ b/tests/testthat/test-multi.R @@ -1,3 +1,248 @@ +# colonnade --------------------------------------------------------------------------- + +test_that("`colonnade()` snapshot test", { + expect_snapshot({ + colonnade() + }) +}) + + +# flatten_colonnade ------------------------------------------------------------------- + +test_that("`flatten_colonnade()` snapshot test", { + expect_snapshot({ + flatten_colonnade() + }) +}) + + +# flatten_column ---------------------------------------------------------------------- + +test_that("`flatten_column()` snapshot test", { + expect_snapshot({ + flatten_column() + }) +}) + + +# flatten_df_column ------------------------------------------------------------------- + +test_that("`flatten_df_column()` snapshot test", { + expect_snapshot({ + flatten_df_column() + }) +}) + + +# flatten_matrix_column --------------------------------------------------------------- + +test_that("`flatten_matrix_column()` snapshot test", { + expect_snapshot({ + flatten_matrix_column() + }) +}) + + +# new_empty_col_sentinel -------------------------------------------------------------- + +test_that("`new_empty_col_sentinel()` snapshot test", { + expect_snapshot({ + new_empty_col_sentinel() + }) +}) + + +# squeeze ----------------------------------------------------------------------------- + +test_that("`squeeze()` snapshot test", { + expect_snapshot({ + squeeze() + }) +}) + + +# squeeze_impl ------------------------------------------------------------------------ + +test_that("`squeeze_impl()` snapshot test", { + expect_snapshot({ + squeeze_impl() + }) +}) + + +# get_rowid_from_colonnade ------------------------------------------------------------ + +test_that("`get_rowid_from_colonnade()` snapshot test", { + expect_snapshot({ + get_rowid_from_colonnade() + }) +}) + + +# new_colonnade_squeezed -------------------------------------------------------------- + +test_that("`new_colonnade_squeezed()` snapshot test", { + expect_snapshot({ + new_colonnade_squeezed() + }) +}) + + +# format_colonnade_tier --------------------------------------------------------------- + +test_that("`format_colonnade_tier()` snapshot test", { + expect_snapshot({ + format_colonnade_tier() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# print ------------------------------------------------------------------------------- + +test_that("`print()` snapshot test", { + expect_snapshot({ + print() + }) +}) + + +# knit_print -------------------------------------------------------------------------- + +test_that("`knit_print()` snapshot test", { + expect_snapshot({ + knit_print() + }) +}) + + +# knit_print_squeezed_colonnade_tier -------------------------------------------------- + +test_that("`knit_print_squeezed_colonnade_tier()` snapshot test", { + expect_snapshot({ + knit_print_squeezed_colonnade_tier() + }) +}) + + +# extra_cols -------------------------------------------------------------------------- + +test_that("`extra_cols()` snapshot test", { + expect_snapshot({ + extra_cols() + }) +}) + + +# extra_cols_impl --------------------------------------------------------------------- + +test_that("`extra_cols_impl()` snapshot test", { + expect_snapshot({ + extra_cols_impl() + }) +}) + + +# colonnade_get_width ----------------------------------------------------------------- + +test_that("`colonnade_get_width()` snapshot test", { + expect_snapshot({ + colonnade_get_width() + }) +}) + + +# get_tier_widths --------------------------------------------------------------------- + +test_that("`get_tier_widths()` snapshot test", { + expect_snapshot({ + get_tier_widths() + }) +}) + + +# colonnade_compute_tiered_col_widths ------------------------------------------------- + +test_that("`colonnade_compute_tiered_col_widths()` snapshot test", { + expect_snapshot({ + colonnade_compute_tiered_col_widths() + }) +}) + + +# colonnade_compute_tiered_col_widths_df ---------------------------------------------- + +test_that("`colonnade_compute_tiered_col_widths_df()` snapshot test", { + expect_snapshot({ + colonnade_compute_tiered_col_widths_df() + }) +}) + + +# combine_pillar_distributions -------------------------------------------------------- + +test_that("`combine_pillar_distributions()` snapshot test", { + expect_snapshot({ + combine_pillar_distributions() + }) +}) + + +# distribute_pillars ------------------------------------------------------------------ + +test_that("`distribute_pillars()` snapshot test", { + expect_snapshot({ + distribute_pillars() + }) +}) + + +# distribute_pillars_rev -------------------------------------------------------------- + +test_that("`distribute_pillars_rev()` snapshot test", { + expect_snapshot({ + distribute_pillars_rev() + }) +}) + + +# all_pillars_fit --------------------------------------------------------------------- + +test_that("`all_pillars_fit()` snapshot test", { + expect_snapshot({ + all_pillars_fit() + }) +}) + + +# colonnade_distribute_space_df ------------------------------------------------------- + +test_that("`colonnade_distribute_space_df()` snapshot test", { + expect_snapshot({ + colonnade_distribute_space_df() + }) +}) + + +# colonnade_distribute_space ---------------------------------------------------------- + +test_that("`colonnade_distribute_space()` snapshot test", { + expect_snapshot({ + colonnade_distribute_space() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("colonnade_compute_tiered_col_widths_df()", { expect_snapshot({ colonnade_compute_tiered_col_widths_df(rep(30, 4), rep(15, 4), rep(60, 4)) diff --git a/tests/testthat/test-num.R b/tests/testthat/test-num.R index 759bbb271..87a7ac4e0 100644 --- a/tests/testthat/test-num.R +++ b/tests/testthat/test-num.R @@ -1,3 +1,122 @@ +# num --------------------------------------------------------------------------------- + +test_that("`num()` snapshot test", { + expect_snapshot({ + num() + }) +}) + + +# vec_ptype_full ---------------------------------------------------------------------- + +test_that("`vec_ptype_full()` snapshot test", { + expect_snapshot({ + vec_ptype_full() + }) +}) + + +# vec_ptype_abbr ---------------------------------------------------------------------- + +test_that("`vec_ptype_abbr()` snapshot test", { + expect_snapshot({ + vec_ptype_abbr() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# vec_arith --------------------------------------------------------------------------- + +test_that("`vec_arith()` snapshot test", { + expect_snapshot({ + vec_arith() + }) +}) + + +# vec_arith.pillar_num ---------------------------------------------------------------- + +test_that("`vec_arith.pillar_num()` snapshot test", { + expect_snapshot({ + vec_arith.pillar_num() + }) +}) + + +# vec_math ---------------------------------------------------------------------------- + +test_that("`vec_math()` snapshot test", { + expect_snapshot({ + vec_math() + }) +}) + + +# set_num_opts ------------------------------------------------------------------------ + +test_that("`set_num_opts()` snapshot test", { + expect_snapshot({ + set_num_opts() + }) +}) + + +# vec_ptype2.pillar_num --------------------------------------------------------------- + +test_that("`vec_ptype2.pillar_num()` snapshot test", { + expect_snapshot({ + vec_ptype2.pillar_num() + }) +}) + + +# vec_ptype2.double ------------------------------------------------------------------- + +test_that("`vec_ptype2.double()` snapshot test", { + expect_snapshot({ + vec_ptype2.double() + }) +}) + + +# vec_ptype2.integer ------------------------------------------------------------------ + +test_that("`vec_ptype2.integer()` snapshot test", { + expect_snapshot({ + vec_ptype2.integer() + }) +}) + + +# vec_cast.pillar_num ----------------------------------------------------------------- + +test_that("`vec_cast.pillar_num()` snapshot test", { + expect_snapshot({ + vec_cast.pillar_num() + }) +}) + + +# vec_cast.double --------------------------------------------------------------------- + +test_that("`vec_cast.double()` snapshot test", { + expect_snapshot({ + vec_cast.double() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("output test", { expect_snapshot({ tibble::tibble( diff --git a/tests/testthat/test-options.R b/tests/testthat/test-options.R index 148718ffe..9334dcec0 100644 --- a/tests/testthat/test-options.R +++ b/tests/testthat/test-options.R @@ -1,3 +1,59 @@ +# tibble_opt -------------------------------------------------------------------------- + +test_that("`tibble_opt()` snapshot test", { + expect_snapshot({ + tibble_opt() + }) +}) + + +# get_width_print --------------------------------------------------------------------- + +test_that("`get_width_print()` snapshot test", { + expect_snapshot({ + get_width_print() + }) +}) + + +# get_width_glimpse ------------------------------------------------------------------- + +test_that("`get_width_glimpse()` snapshot test", { + expect_snapshot({ + get_width_glimpse() + }) +}) + + +# get_n_print ------------------------------------------------------------------------- + +test_that("`get_n_print()` snapshot test", { + expect_snapshot({ + get_n_print() + }) +}) + + +# get_max_extra_cols ------------------------------------------------------------------ + +test_that("`get_max_extra_cols()` snapshot test", { + expect_snapshot({ + get_max_extra_cols() + }) +}) + + +# get_max_footer_lines ---------------------------------------------------------------- + +test_that("`get_max_footer_lines()` snapshot test", { + expect_snapshot({ + get_max_footer_lines() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("print_max", { value <- 15L diff --git a/tests/testthat/test-ornament.R b/tests/testthat/test-ornament.R index 9aebcfb73..933380647 100644 --- a/tests/testthat/test-ornament.R +++ b/tests/testthat/test-ornament.R @@ -1,3 +1,32 @@ +# new_ornament ------------------------------------------------------------------------ + +test_that("`new_ornament()` snapshot test", { + expect_snapshot({ + new_ornament() + }) +}) + + +# print ------------------------------------------------------------------------------- + +test_that("`print()` snapshot test", { + expect_snapshot({ + print() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("ornament", { expect_snapshot({ new_ornament(c("abc", "de")) diff --git a/tests/testthat/test-pillar-package.R b/tests/testthat/test-pillar-package.R new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/tests/testthat/test-pillar-package.R @@ -0,0 +1 @@ + diff --git a/tests/testthat/test-pillar.R b/tests/testthat/test-pillar.R new file mode 100644 index 000000000..9a2a848eb --- /dev/null +++ b/tests/testthat/test-pillar.R @@ -0,0 +1,70 @@ +# rowidformat ------------------------------------------------------------------------- + +test_that("`rowidformat()` snapshot test", { + expect_snapshot({ + rowidformat() + }) +}) + + +# new_pillar_1e ----------------------------------------------------------------------- + +test_that("`new_pillar_1e()` snapshot test", { + expect_snapshot({ + new_pillar_1e() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# print ------------------------------------------------------------------------------- + +test_that("`print()` snapshot test", { + expect_snapshot({ + print() + }) +}) + + +# pillar_get_width_1e ----------------------------------------------------------------- + +test_that("`pillar_get_width_1e()` snapshot test", { + expect_snapshot({ + pillar_get_width_1e() + }) +}) + + +# pillar_format_parts ----------------------------------------------------------------- + +test_that("`pillar_format_parts()` snapshot test", { + expect_snapshot({ + pillar_format_parts() + }) +}) + + +# format_abbrev ----------------------------------------------------------------------- + +test_that("`format_abbrev()` snapshot test", { + expect_snapshot({ + format_abbrev() + }) +}) + + +# format_full_pillar_title ------------------------------------------------------------ + +test_that("`format_full_pillar_title()` snapshot test", { + expect_snapshot({ + format_full_pillar_title() + }) +}) diff --git a/tests/testthat/test-pluralise.R b/tests/testthat/test-pluralise.R new file mode 100644 index 000000000..dd5340102 --- /dev/null +++ b/tests/testthat/test-pluralise.R @@ -0,0 +1,16 @@ +# pluralise --------------------------------------------------------------------------- + +test_that("`pluralise()` snapshot test", { + expect_snapshot({ + pluralise() + }) +}) + + +# pluralise_n ------------------------------------------------------------------------- + +test_that("`pluralise_n()` snapshot test", { + expect_snapshot({ + pluralise_n() + }) +}) diff --git a/tests/testthat/test-register-s3.R b/tests/testthat/test-register-s3.R new file mode 100644 index 000000000..92fabccbc --- /dev/null +++ b/tests/testthat/test-register-s3.R @@ -0,0 +1,16 @@ +# s3_register ------------------------------------------------------------------------- + +test_that("`s3_register()` snapshot test", { + expect_snapshot({ + s3_register() + }) +}) + + +# ------------------------------------------------------------------------------------ + +test_that("`()` snapshot test", { + expect_snapshot({ + () + }) +}) diff --git a/tests/testthat/test-rowid-capital.R b/tests/testthat/test-rowid-capital.R new file mode 100644 index 000000000..a7cb22f35 --- /dev/null +++ b/tests/testthat/test-rowid-capital.R @@ -0,0 +1,7 @@ +# rif_capital ------------------------------------------------------------------------- + +test_that("`rif_capital()` snapshot test", { + expect_snapshot({ + rif_capital() + }) +}) diff --git a/tests/testthat/test-rowid-data.R b/tests/testthat/test-rowid-data.R new file mode 100644 index 000000000..723b6f725 --- /dev/null +++ b/tests/testthat/test-rowid-data.R @@ -0,0 +1,25 @@ +# style_rowid ------------------------------------------------------------------------- + +test_that("`style_rowid()` snapshot test", { + expect_snapshot({ + style_rowid() + }) +}) + + +# rif_shaft --------------------------------------------------------------------------- + +test_that("`rif_shaft()` snapshot test", { + expect_snapshot({ + rif_shaft() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) diff --git a/tests/testthat/test-rowid-title.R b/tests/testthat/test-rowid-title.R new file mode 100644 index 000000000..090039919 --- /dev/null +++ b/tests/testthat/test-rowid-title.R @@ -0,0 +1,16 @@ +# rif_title --------------------------------------------------------------------------- + +test_that("`rif_title()` snapshot test", { + expect_snapshot({ + rif_title() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) diff --git a/tests/testthat/test-rowid-type.R b/tests/testthat/test-rowid-type.R new file mode 100644 index 000000000..a6e322ba1 --- /dev/null +++ b/tests/testthat/test-rowid-type.R @@ -0,0 +1,25 @@ +# style_star -------------------------------------------------------------------------- + +test_that("`style_star()` snapshot test", { + expect_snapshot({ + style_star() + }) +}) + + +# rif_type ---------------------------------------------------------------------------- + +test_that("`rif_type()` snapshot test", { + expect_snapshot({ + rif_type() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) diff --git a/tests/testthat/test-scientific.R b/tests/testthat/test-scientific.R new file mode 100644 index 000000000..66da8a2a0 --- /dev/null +++ b/tests/testthat/test-scientific.R @@ -0,0 +1,25 @@ +# format_exp -------------------------------------------------------------------------- + +test_that("`format_exp()` snapshot test", { + expect_snapshot({ + format_exp() + }) +}) + + +# si ---------------------------------------------------------------------------------- + +test_that("`si()` snapshot test", { + expect_snapshot({ + si() + }) +}) + + +# supernum ---------------------------------------------------------------------------- + +test_that("`supernum()` snapshot test", { + expect_snapshot({ + supernum() + }) +}) diff --git a/tests/testthat/test-shaft-.R b/tests/testthat/test-shaft-.R index a70f1a952..8de26dbb7 100644 --- a/tests/testthat/test-shaft-.R +++ b/tests/testthat/test-shaft-.R @@ -1,3 +1,68 @@ +# new_pillar_shaft -------------------------------------------------------------------- + +test_that("`new_pillar_shaft()` snapshot test", { + expect_snapshot({ + new_pillar_shaft() + }) +}) + + +# pillar_shaft ------------------------------------------------------------------------ + +test_that("`pillar_shaft()` snapshot test", { + expect_snapshot({ + pillar_shaft() + }) +}) + + +# print ------------------------------------------------------------------------------- + +test_that("`print()` snapshot test", { + expect_snapshot({ + print() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# pillar_shaft_number_attr ------------------------------------------------------------ + +test_that("`pillar_shaft_number_attr()` snapshot test", { + expect_snapshot({ + pillar_shaft_number_attr() + }) +}) + + +# pillar_shaft_number ----------------------------------------------------------------- + +test_that("`pillar_shaft_number()` snapshot test", { + expect_snapshot({ + pillar_shaft_number() + }) +}) + + +# type_sum ---------------------------------------------------------------------------- + +test_that("`type_sum()` snapshot test", { + expect_snapshot({ + type_sum() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("S4 character class (tidyverse/tibble#1367)", { skip_if_not_installed("DBI") expect_snapshot({ diff --git a/tests/testthat/test-shaft-simple.R b/tests/testthat/test-shaft-simple.R new file mode 100644 index 000000000..c6c3ab21e --- /dev/null +++ b/tests/testthat/test-shaft-simple.R @@ -0,0 +1,16 @@ +# new_pillar_shaft_simple ------------------------------------------------------------- + +test_that("`new_pillar_shaft_simple()` snapshot test", { + expect_snapshot({ + new_pillar_shaft_simple() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) diff --git a/tests/testthat/test-show_source.R b/tests/testthat/test-show_source.R new file mode 100644 index 000000000..10f4296ea --- /dev/null +++ b/tests/testthat/test-show_source.R @@ -0,0 +1,25 @@ +# set_show_source_hooks --------------------------------------------------------------- + +test_that("`set_show_source_hooks()` snapshot test", { + expect_snapshot({ + set_show_source_hooks() + }) +}) + + +# set_show_source_opts_hook ----------------------------------------------------------- + +test_that("`set_show_source_opts_hook()` snapshot test", { + expect_snapshot({ + set_show_source_opts_hook() + }) +}) + + +# set_show_source_source_hook --------------------------------------------------------- + +test_that("`set_show_source_source_hook()` snapshot test", { + expect_snapshot({ + set_show_source_source_hook() + }) +}) diff --git a/tests/testthat/test-sigfig.R b/tests/testthat/test-sigfig.R new file mode 100644 index 000000000..49b123e96 --- /dev/null +++ b/tests/testthat/test-sigfig.R @@ -0,0 +1,178 @@ +# split_decimal ----------------------------------------------------------------------- + +test_that("`split_decimal()` snapshot test", { + expect_snapshot({ + split_decimal() + }) +}) + + +# fix_exp ----------------------------------------------------------------------------- + +test_that("`fix_exp()` snapshot test", { + expect_snapshot({ + fix_exp() + }) +}) + + +# get_decimal_width ------------------------------------------------------------------- + +test_that("`get_decimal_width()` snapshot test", { + expect_snapshot({ + get_decimal_width() + }) +}) + + +# safe_signif ------------------------------------------------------------------------- + +test_that("`safe_signif()` snapshot test", { + expect_snapshot({ + safe_signif() + }) +}) + + +# safe_divide_10_to ------------------------------------------------------------------- + +test_that("`safe_divide_10_to()` snapshot test", { + expect_snapshot({ + safe_divide_10_to() + }) +}) + + +# within_tolerance -------------------------------------------------------------------- + +test_that("`within_tolerance()` snapshot test", { + expect_snapshot({ + within_tolerance() + }) +}) + + +# compute_rhs_digits ------------------------------------------------------------------ + +test_that("`compute_rhs_digits()` snapshot test", { + expect_snapshot({ + compute_rhs_digits() + }) +}) + + +# compute_min_sigfig ------------------------------------------------------------------ + +test_that("`compute_min_sigfig()` snapshot test", { + expect_snapshot({ + compute_min_sigfig() + }) +}) + + +# compute_extra_sigfig ---------------------------------------------------------------- + +test_that("`compute_extra_sigfig()` snapshot test", { + expect_snapshot({ + compute_extra_sigfig() + }) +}) + + +# compute_exp ------------------------------------------------------------------------- + +test_that("`compute_exp()` snapshot test", { + expect_snapshot({ + compute_exp() + }) +}) + + +# format_mantissa --------------------------------------------------------------------- + +test_that("`format_mantissa()` snapshot test", { + expect_snapshot({ + format_mantissa() + }) +}) + + +# format_neg -------------------------------------------------------------------------- + +test_that("`format_neg()` snapshot test", { + expect_snapshot({ + format_neg() + }) +}) + + +# format_lhs -------------------------------------------------------------------------- + +test_that("`format_lhs()` snapshot test", { + expect_snapshot({ + format_lhs() + }) +}) + + +# underline_3_back -------------------------------------------------------------------- + +test_that("`underline_3_back()` snapshot test", { + expect_snapshot({ + underline_3_back() + }) +}) + + +# format_dec -------------------------------------------------------------------------- + +test_that("`format_dec()` snapshot test", { + expect_snapshot({ + format_dec() + }) +}) + + +# format_rhs -------------------------------------------------------------------------- + +test_that("`format_rhs()` snapshot test", { + expect_snapshot({ + format_rhs() + }) +}) + + +# underline_3 ------------------------------------------------------------------------- + +test_that("`underline_3()` snapshot test", { + expect_snapshot({ + underline_3() + }) +}) + + +# style_num --------------------------------------------------------------------------- + +test_that("`style_num()` snapshot test", { + expect_snapshot({ + style_num() + }) +}) + + +# assemble_decimal -------------------------------------------------------------------- + +test_that("`assemble_decimal()` snapshot test", { + expect_snapshot({ + assemble_decimal() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) diff --git a/tests/testthat/test-strrep.R b/tests/testthat/test-strrep.R new file mode 100644 index 000000000..25371ca89 --- /dev/null +++ b/tests/testthat/test-strrep.R @@ -0,0 +1,7 @@ +# strrep_compat ----------------------------------------------------------------------- + +test_that("`strrep_compat()` snapshot test", { + expect_snapshot({ + strrep_compat() + }) +}) diff --git a/tests/testthat/test-styles.R b/tests/testthat/test-styles.R new file mode 100644 index 000000000..7ef3040cf --- /dev/null +++ b/tests/testthat/test-styles.R @@ -0,0 +1,133 @@ +# keep_empty -------------------------------------------------------------------------- + +test_that("`keep_empty()` snapshot test", { + expect_snapshot({ + keep_empty() + }) +}) + + +# style_subtle_num -------------------------------------------------------------------- + +test_that("`style_subtle_num()` snapshot test", { + expect_snapshot({ + style_subtle_num() + }) +}) + + +# style_spark_na ---------------------------------------------------------------------- + +test_that("`style_spark_na()` snapshot test", { + expect_snapshot({ + style_spark_na() + }) +}) + + +# style_na ---------------------------------------------------------------------------- + +test_that("`style_na()` snapshot test", { + expect_snapshot({ + style_na() + }) +}) + + +# pillar_na --------------------------------------------------------------------------- + +test_that("`pillar_na()` snapshot test", { + expect_snapshot({ + pillar_na() + }) +}) + + +# style_list -------------------------------------------------------------------------- + +test_that("`style_list()` snapshot test", { + expect_snapshot({ + style_list() + }) +}) + + +# has_color --------------------------------------------------------------------------- + +test_that("`has_color()` snapshot test", { + expect_snapshot({ + has_color() + }) +}) + + +# make_style_fast --------------------------------------------------------------------- + +test_that("`make_style_fast()` snapshot test", { + expect_snapshot({ + make_style_fast() + }) +}) + + +# crayon_underline -------------------------------------------------------------------- + +test_that("`crayon_underline()` snapshot test", { + expect_snapshot({ + crayon_underline() + }) +}) + + +# crayon_italic ----------------------------------------------------------------------- + +test_that("`crayon_italic()` snapshot test", { + expect_snapshot({ + crayon_italic() + }) +}) + + +# crayon_red -------------------------------------------------------------------------- + +test_that("`crayon_red()` snapshot test", { + expect_snapshot({ + crayon_red() + }) +}) + + +# crayon_yellow ----------------------------------------------------------------------- + +test_that("`crayon_yellow()` snapshot test", { + expect_snapshot({ + crayon_yellow() + }) +}) + + +# crayon_bold ------------------------------------------------------------------------- + +test_that("`crayon_bold()` snapshot test", { + expect_snapshot({ + crayon_bold() + }) +}) + + +# crayon_grey_0 ----------------------------------------------------------------------- + +test_that("`crayon_grey_0()` snapshot test", { + expect_snapshot({ + crayon_grey_0() + }) +}) + + +# assign_crayon_styles ---------------------------------------------------------------- + +test_that("`assign_crayon_styles()` snapshot test", { + expect_snapshot({ + assign_crayon_styles() + }) +}) diff --git a/tests/testthat/test-tbl-format-body.R b/tests/testthat/test-tbl-format-body.R index 5397fffe3..7833f55df 100644 --- a/tests/testthat/test-tbl-format-body.R +++ b/tests/testthat/test-tbl-format-body.R @@ -1,3 +1,14 @@ +# tbl_format_body --------------------------------------------------------------------- + +test_that("`tbl_format_body()` snapshot test", { + expect_snapshot({ + tbl_format_body() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("tbl_format_body() results", { expect_snapshot({ "Various column types" diff --git a/tests/testthat/test-tbl-format-footer.R b/tests/testthat/test-tbl-format-footer.R index 8de31aeb7..b94feaadc 100644 --- a/tests/testthat/test-tbl-format-footer.R +++ b/tests/testthat/test-tbl-format-footer.R @@ -1,3 +1,131 @@ +# tbl_format_footer ------------------------------------------------------------------- + +test_that("`tbl_format_footer()` snapshot test", { + expect_snapshot({ + tbl_format_footer() + }) +}) + + +# format_footer ----------------------------------------------------------------------- + +test_that("`format_footer()` snapshot test", { + expect_snapshot({ + format_footer() + }) +}) + + +# format_footer_extra_rows ------------------------------------------------------------ + +test_that("`format_footer_extra_rows()` snapshot test", { + expect_snapshot({ + format_footer_extra_rows() + }) +}) + + +# format_footer_abbrev_cols ----------------------------------------------------------- + +test_that("`format_footer_abbrev_cols()` snapshot test", { + expect_snapshot({ + format_footer_abbrev_cols() + }) +}) + + +# format_footer_extra_cols ------------------------------------------------------------ + +test_that("`format_footer_extra_cols()` snapshot test", { + expect_snapshot({ + format_footer_extra_cols() + }) +}) + + +# format_extra_vars ------------------------------------------------------------------- + +test_that("`format_extra_vars()` snapshot test", { + expect_snapshot({ + format_extra_vars() + }) +}) + + +# format_footer_advice ---------------------------------------------------------------- + +test_that("`format_footer_advice()` snapshot test", { + expect_snapshot({ + format_footer_advice() + }) +}) + + +# wrap_footer_bullet ------------------------------------------------------------------ + +test_that("`wrap_footer_bullet()` snapshot test", { + expect_snapshot({ + wrap_footer_bullet() + }) +}) + + +# wrap_footer_bullet_one -------------------------------------------------------------- + +test_that("`wrap_footer_bullet_one()` snapshot test", { + expect_snapshot({ + wrap_footer_bullet_one() + }) +}) + + +# get_footer_tier_widths_bullets ------------------------------------------------------ + +test_that("`get_footer_tier_widths_bullets()` snapshot test", { + expect_snapshot({ + get_footer_tier_widths_bullets() + }) +}) + + +# pre_dots ---------------------------------------------------------------------------- + +test_that("`pre_dots()` snapshot test", { + expect_snapshot({ + pre_dots() + }) +}) + + +# collapse ---------------------------------------------------------------------------- + +test_that("`collapse()` snapshot test", { + expect_snapshot({ + collapse() + }) +}) + + +# split_lines ------------------------------------------------------------------------- + +test_that("`split_lines()` snapshot test", { + expect_snapshot({ + split_lines() + }) +}) + + +# enum_collapse ----------------------------------------------------------------------- + +test_that("`enum_collapse()` snapshot test", { + expect_snapshot({ + enum_collapse() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("tbl_format_footer() results", { local_colors() diff --git a/tests/testthat/test-tbl-format-header.R b/tests/testthat/test-tbl-format-header.R index af20b5bcb..78e6c0796 100644 --- a/tests/testthat/test-tbl-format-header.R +++ b/tests/testthat/test-tbl-format-header.R @@ -1,3 +1,14 @@ +# tbl_format_header ------------------------------------------------------------------- + +test_that("`tbl_format_header()` snapshot test", { + expect_snapshot({ + tbl_format_header() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("tbl_format_header() results", { local_unknown_rows() local_foo_tbl() diff --git a/tests/testthat/test-tbl-format-setup.R b/tests/testthat/test-tbl-format-setup.R index 89fd559d8..737f30d6c 100644 --- a/tests/testthat/test-tbl-format-setup.R +++ b/tests/testthat/test-tbl-format-setup.R @@ -1,3 +1,59 @@ +# tbl_format_setup -------------------------------------------------------------------- + +test_that("`tbl_format_setup()` snapshot test", { + expect_snapshot({ + tbl_format_setup() + }) +}) + + +# tbl_format_setup_dispatch ----------------------------------------------------------- + +test_that("`tbl_format_setup_dispatch()` snapshot test", { + expect_snapshot({ + tbl_format_setup_dispatch() + }) +}) + + +# new_tbl_format_setup ---------------------------------------------------------------- + +test_that("`new_tbl_format_setup()` snapshot test", { + expect_snapshot({ + new_tbl_format_setup() + }) +}) + + +# is_tbl_format_setup ----------------------------------------------------------------- + +test_that("`is_tbl_format_setup()` snapshot test", { + expect_snapshot({ + is_tbl_format_setup() + }) +}) + + +# print ------------------------------------------------------------------------------- + +test_that("`print()` snapshot test", { + expect_snapshot({ + print() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("output test", { x <- new_tbl(list( column_zero_zero = 1:3 + 0.23, diff --git a/tests/testthat/test-tbl-format.R b/tests/testthat/test-tbl-format.R index a36183aac..084628f17 100644 --- a/tests/testthat/test-tbl-format.R +++ b/tests/testthat/test-tbl-format.R @@ -1,3 +1,68 @@ +# print ------------------------------------------------------------------------------- + +test_that("`print()` snapshot test", { + expect_snapshot({ + print() + }) +}) + + +# print_tbl --------------------------------------------------------------------------- + +test_that("`print_tbl()` snapshot test", { + expect_snapshot({ + print_tbl() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# format_tbl -------------------------------------------------------------------------- + +test_that("`format_tbl()` snapshot test", { + expect_snapshot({ + format_tbl() + }) +}) + + +# format_comment ---------------------------------------------------------------------- + +test_that("`format_comment()` snapshot test", { + expect_snapshot({ + format_comment() + }) +}) + + +# wrap -------------------------------------------------------------------------------- + +test_that("`wrap()` snapshot test", { + expect_snapshot({ + wrap() + }) +}) + + +# strwrap2 ---------------------------------------------------------------------------- + +test_that("`strwrap2()` snapshot test", { + expect_snapshot({ + strwrap2() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("print() returns output invisibly", { expect_output(ret <- withVisible(print(as_tbl(trees)))) expect_false(ret$visible) diff --git a/tests/testthat/test-tbl-sum.R b/tests/testthat/test-tbl-sum.R new file mode 100644 index 000000000..3aaae9555 --- /dev/null +++ b/tests/testthat/test-tbl-sum.R @@ -0,0 +1,7 @@ +# tbl_sum ----------------------------------------------------------------------------- + +test_that("`tbl_sum()` snapshot test", { + expect_snapshot({ + tbl_sum() + }) +}) diff --git a/tests/testthat/test-tbl.R b/tests/testthat/test-tbl.R new file mode 100644 index 000000000..587fc6ec6 --- /dev/null +++ b/tests/testthat/test-tbl.R @@ -0,0 +1,25 @@ +# new_tbl ----------------------------------------------------------------------------- + +test_that("`new_tbl()` snapshot test", { + expect_snapshot({ + new_tbl() + }) +}) + + +# as_tbl ------------------------------------------------------------------------------ + +test_that("`as_tbl()` snapshot test", { + expect_snapshot({ + as_tbl() + }) +}) + + +# as_tbl.data ------------------------------------------------------------------------- + +test_that("`as_tbl.data()` snapshot test", { + expect_snapshot({ + as_tbl.data() + }) +}) diff --git a/tests/testthat/test-testthat.R b/tests/testthat/test-testthat.R new file mode 100644 index 000000000..1b5f4f5bb --- /dev/null +++ b/tests/testthat/test-testthat.R @@ -0,0 +1,7 @@ +# expect_known_display ---------------------------------------------------------------- + +test_that("`expect_known_display()` snapshot test", { + expect_snapshot({ + expect_known_display() + }) +}) diff --git a/tests/testthat/test-tick.R b/tests/testthat/test-tick.R new file mode 100644 index 000000000..76e1322ae --- /dev/null +++ b/tests/testthat/test-tick.R @@ -0,0 +1,52 @@ +# format_title ------------------------------------------------------------------------ + +test_that("`format_title()` snapshot test", { + expect_snapshot({ + format_title() + }) +}) + + +# tick_names_if_needed ---------------------------------------------------------------- + +test_that("`tick_names_if_needed()` snapshot test", { + expect_snapshot({ + tick_names_if_needed() + }) +}) + + +# tick_if_needed ---------------------------------------------------------------------- + +test_that("`tick_if_needed()` snapshot test", { + expect_snapshot({ + tick_if_needed() + }) +}) + + +# is_syntactic ------------------------------------------------------------------------ + +test_that("`is_syntactic()` snapshot test", { + expect_snapshot({ + is_syntactic() + }) +}) + + +# is_ambiguous_string ----------------------------------------------------------------- + +test_that("`is_ambiguous_string()` snapshot test", { + expect_snapshot({ + is_ambiguous_string() + }) +}) + + +# tick -------------------------------------------------------------------------------- + +test_that("`tick()` snapshot test", { + expect_snapshot({ + tick() + }) +}) diff --git a/tests/testthat/test-title.R b/tests/testthat/test-title.R index 30fea7cc4..a630f4fcc 100644 --- a/tests/testthat/test-title.R +++ b/tests/testthat/test-title.R @@ -1,3 +1,32 @@ +# new_pillar_title -------------------------------------------------------------------- + +test_that("`new_pillar_title()` snapshot test", { + expect_snapshot({ + new_pillar_title() + }) +}) + + +# get_min_title_width ----------------------------------------------------------------- + +test_that("`get_min_title_width()` snapshot test", { + expect_snapshot({ + get_min_title_width() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("with and without title", { expect_snapshot({ pillar(add_special(10^(1:6))) diff --git a/tests/testthat/test-type-sum.R b/tests/testthat/test-type-sum.R new file mode 100644 index 000000000..b0cf67dda --- /dev/null +++ b/tests/testthat/test-type-sum.R @@ -0,0 +1,34 @@ +# type_sum ---------------------------------------------------------------------------- + +test_that("`type_sum()` snapshot test", { + expect_snapshot({ + type_sum() + }) +}) + + +# vec_ptype_abbr ---------------------------------------------------------------------- + +test_that("`vec_ptype_abbr()` snapshot test", { + expect_snapshot({ + vec_ptype_abbr() + }) +}) + + +# obj_sum ----------------------------------------------------------------------------- + +test_that("`obj_sum()` snapshot test", { + expect_snapshot({ + obj_sum() + }) +}) + + +# size_sum ---------------------------------------------------------------------------- + +test_that("`size_sum()` snapshot test", { + expect_snapshot({ + size_sum() + }) +}) diff --git a/tests/testthat/test-type.R b/tests/testthat/test-type.R new file mode 100644 index 000000000..784a6ba20 --- /dev/null +++ b/tests/testthat/test-type.R @@ -0,0 +1,70 @@ +# style_type -------------------------------------------------------------------------- + +test_that("`style_type()` snapshot test", { + expect_snapshot({ + style_type() + }) +}) + + +# new_pillar_type --------------------------------------------------------------------- + +test_that("`new_pillar_type()` snapshot test", { + expect_snapshot({ + new_pillar_type() + }) +}) + + +# new_pillar_type_obj ----------------------------------------------------------------- + +test_that("`new_pillar_type_obj()` snapshot test", { + expect_snapshot({ + new_pillar_type_obj() + }) +}) + + +# get_pillar_type --------------------------------------------------------------------- + +test_that("`get_pillar_type()` snapshot test", { + expect_snapshot({ + get_pillar_type() + }) +}) + + +# format ------------------------------------------------------------------------------ + +test_that("`format()` snapshot test", { + expect_snapshot({ + format() + }) +}) + + +# format_full_pillar_type ------------------------------------------------------------- + +test_that("`format_full_pillar_type()` snapshot test", { + expect_snapshot({ + format_full_pillar_type() + }) +}) + + +# format_type_sum --------------------------------------------------------------------- + +test_that("`format_type_sum()` snapshot test", { + expect_snapshot({ + format_type_sum() + }) +}) + + +# type_sum ---------------------------------------------------------------------------- + +test_that("`type_sum()` snapshot test", { + expect_snapshot({ + type_sum() + }) +}) diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R new file mode 100644 index 000000000..e4ed35626 --- /dev/null +++ b/tests/testthat/test-utils.R @@ -0,0 +1,178 @@ +# df_head ----------------------------------------------------------------------------- + +test_that("`df_head()` snapshot test", { + expect_snapshot({ + df_head() + }) +}) + + +# vec_head ---------------------------------------------------------------------------- + +test_that("`vec_head()` snapshot test", { + expect_snapshot({ + vec_head() + }) +}) + + +# cat_line ---------------------------------------------------------------------------- + +test_that("`cat_line()` snapshot test", { + expect_snapshot({ + cat_line() + }) +}) + + +# str_trunc --------------------------------------------------------------------------- + +test_that("`str_trunc()` snapshot test", { + expect_snapshot({ + str_trunc() + }) +}) + + +# str_add_ellipsis -------------------------------------------------------------------- + +test_that("`str_add_ellipsis()` snapshot test", { + expect_snapshot({ + str_add_ellipsis() + }) +}) + + +# str_add_ellipsis_untick ------------------------------------------------------------- + +test_that("`str_add_ellipsis_untick()` snapshot test", { + expect_snapshot({ + str_add_ellipsis_untick() + }) +}) + + +# paste_with_space_if_needed ---------------------------------------------------------- + +test_that("`paste_with_space_if_needed()` snapshot test", { + expect_snapshot({ + paste_with_space_if_needed() + }) +}) + + +# check_sigfig ------------------------------------------------------------------------ + +test_that("`check_sigfig()` snapshot test", { + expect_snapshot({ + check_sigfig() + }) +}) + + +# slice ------------------------------------------------------------------------------- + +test_that("`slice()` snapshot test", { + expect_snapshot({ + slice() + }) +}) + + +# bind_rows --------------------------------------------------------------------------- + +test_that("`bind_rows()` snapshot test", { + expect_snapshot({ + bind_rows() + }) +}) + + +# get_ellipsis ------------------------------------------------------------------------ + +test_that("`get_ellipsis()` snapshot test", { + expect_snapshot({ + get_ellipsis() + }) +}) + + +# is_latex_output --------------------------------------------------------------------- + +test_that("`is_latex_output()` snapshot test", { + expect_snapshot({ + is_latex_output() + }) +}) + + +# remove_as_is_class ------------------------------------------------------------------ + +test_that("`remove_as_is_class()` snapshot test", { + expect_snapshot({ + remove_as_is_class() + }) +}) + + +# v ----------------------------------------------------------------------------------- + +test_that("`v()` snapshot test", { + expect_snapshot({ + v() + }) +}) + + +# safe_is_na -------------------------------------------------------------------------- + +test_that("`safe_is_na()` snapshot test", { + expect_snapshot({ + safe_is_na() + }) +}) + + +# safe_any_na ------------------------------------------------------------------------- + +test_that("`safe_any_na()` snapshot test", { + expect_snapshot({ + safe_any_na() + }) +}) + + +# vec_lead ---------------------------------------------------------------------------- + +test_that("`vec_lead()` snapshot test", { + expect_snapshot({ + vec_lead() + }) +}) + + +# vec_lag ----------------------------------------------------------------------------- + +test_that("`vec_lag()` snapshot test", { + expect_snapshot({ + vec_lag() + }) +}) + + +# superdigit -------------------------------------------------------------------------- + +test_that("`superdigit()` snapshot test", { + expect_snapshot({ + superdigit() + }) +}) + + +# superdigit_sep_default -------------------------------------------------------------- + +test_that("`superdigit_sep_default()` snapshot test", { + expect_snapshot({ + superdigit_sep_default() + }) +}) diff --git a/tests/testthat/test-vctr.R b/tests/testthat/test-vctr.R index 94d757c6d..845294879 100644 --- a/tests/testthat/test-vctr.R +++ b/tests/testthat/test-vctr.R @@ -1,3 +1,77 @@ +# pillar_shaft ------------------------------------------------------------------------ + +test_that("`pillar_shaft()` snapshot test", { + expect_snapshot({ + pillar_shaft() + }) +}) + + +# vec_ptype_full ---------------------------------------------------------------------- + +test_that("`vec_ptype_full()` snapshot test", { + expect_snapshot({ + vec_ptype_full() + }) +}) + + +# print ------------------------------------------------------------------------------- + +test_that("`print()` snapshot test", { + expect_snapshot({ + print() + }) +}) + + +# obj_print_header -------------------------------------------------------------------- + +test_that("`obj_print_header()` snapshot test", { + expect_snapshot({ + obj_print_header() + }) +}) + + +# obj_print_data ---------------------------------------------------------------------- + +test_that("`obj_print_data()` snapshot test", { + expect_snapshot({ + obj_print_data() + }) +}) + + +# obj_print_footer -------------------------------------------------------------------- + +test_that("`obj_print_footer()` snapshot test", { + expect_snapshot({ + obj_print_footer() + }) +}) + + +# vec_proxy_compare ------------------------------------------------------------------- + +test_that("`vec_proxy_compare()` snapshot test", { + expect_snapshot({ + vec_proxy_compare() + }) +}) + + +# vec_proxy_order --------------------------------------------------------------------- + +test_that("`vec_proxy_order()` snapshot test", { + expect_snapshot({ + vec_proxy_order() + }) +}) + + +# Legacy tests ------------------------------------------------------------------------ + test_that("max argument", { expect_snapshot({ print(num(1:10), max = 5) diff --git a/tests/testthat/test-vctrs.R b/tests/testthat/test-vctrs.R new file mode 100644 index 000000000..1ff32bbcf --- /dev/null +++ b/tests/testthat/test-vctrs.R @@ -0,0 +1,16 @@ +# pillar_shaft ------------------------------------------------------------------------ + +test_that("`pillar_shaft()` snapshot test", { + expect_snapshot({ + pillar_shaft() + }) +}) + + +# type_sum ---------------------------------------------------------------------------- + +test_that("`type_sum()` snapshot test", { + expect_snapshot({ + type_sum() + }) +}) diff --git a/tests/testthat/test-width.R b/tests/testthat/test-width.R new file mode 100644 index 000000000..71d95804b --- /dev/null +++ b/tests/testthat/test-width.R @@ -0,0 +1,52 @@ +# get_width --------------------------------------------------------------------------- + +test_that("`get_width()` snapshot test", { + expect_snapshot({ + get_width() + }) +}) + + +# set_width --------------------------------------------------------------------------- + +test_that("`set_width()` snapshot test", { + expect_snapshot({ + set_width() + }) +}) + + +# get_widths -------------------------------------------------------------------------- + +test_that("`get_widths()` snapshot test", { + expect_snapshot({ + get_widths() + }) +}) + + +# get_min_width ----------------------------------------------------------------------- + +test_that("`get_min_width()` snapshot test", { + expect_snapshot({ + get_min_width() + }) +}) + + +# set_min_width ----------------------------------------------------------------------- + +test_that("`set_min_width()` snapshot test", { + expect_snapshot({ + set_min_width() + }) +}) + + +# get_min_widths ---------------------------------------------------------------------- + +test_that("`get_min_widths()` snapshot test", { + expect_snapshot({ + get_min_widths() + }) +}) diff --git a/tests/testthat/test-zzz.R b/tests/testthat/test-zzz.R new file mode 100644 index 000000000..8bbbf4e3c --- /dev/null +++ b/tests/testthat/test-zzz.R @@ -0,0 +1,70 @@ +# ------------------------------------------------------------------------------------ + +test_that("`()` snapshot test", { + expect_snapshot({ + () + }) +}) + + +# activate_debugme -------------------------------------------------------------------- + +test_that("`activate_debugme()` snapshot test", { + expect_snapshot({ + activate_debugme() + }) +}) + + +# deactivate_debugme ------------------------------------------------------------------ + +test_that("`deactivate_debugme()` snapshot test", { + expect_snapshot({ + deactivate_debugme() + }) +}) + + +# get_debugme ------------------------------------------------------------------------- + +test_that("`get_debugme()` snapshot test", { + expect_snapshot({ + get_debugme() + }) +}) + + +# set_debugme ------------------------------------------------------------------------- + +test_that("`set_debugme()` snapshot test", { + expect_snapshot({ + set_debugme() + }) +}) + + +# remove_from_logging ----------------------------------------------------------------- + +test_that("`remove_from_logging()` snapshot test", { + expect_snapshot({ + remove_from_logging() + }) +}) + + +# debug_info -------------------------------------------------------------------------- + +test_that("`debug_info()` snapshot test", { + expect_snapshot({ + debug_info() + }) +}) + + +# get_pkgname ------------------------------------------------------------------------- + +test_that("`get_pkgname()` snapshot test", { + expect_snapshot({ + get_pkgname() + }) +})