Skip to content

Commit

Permalink
One test per method, still use generic in snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Nov 22, 2024
1 parent 5b5b0ce commit 2f7d830
Show file tree
Hide file tree
Showing 33 changed files with 635 additions and 122 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/test-capital.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ test_that("`new_pillar_capital()` snapshot test", {
})


# format ------------------------------------------------------------------------------
# format.pillar_capital ---------------------------------------------------------------

test_that("`format()` snapshot test", {
test_that("`format.pillar_capital()` snapshot test", {
expect_snapshot({
format()
})
Expand Down
55 changes: 41 additions & 14 deletions tests/testthat/test-char.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ test_that("`char()` snapshot test", {
})


# vec_ptype_full ----------------------------------------------------------------------
# vec_ptype_full.pillar_char ----------------------------------------------------------

test_that("`vec_ptype_full()` snapshot test", {
test_that("`vec_ptype_full.pillar_char()` snapshot test", {
expect_snapshot({
vec_ptype_full()
})
})


# vec_ptype_abbr ----------------------------------------------------------------------
# vec_ptype_abbr.pillar_char ----------------------------------------------------------

test_that("`vec_ptype_abbr()` snapshot test", {
test_that("`vec_ptype_abbr.pillar_char()` snapshot test", {
expect_snapshot({
vec_ptype_abbr()
})
})


# format ------------------------------------------------------------------------------
# format.pillar_char ------------------------------------------------------------------

test_that("`format()` snapshot test", {
test_that("`format.pillar_char()` snapshot test", {
expect_snapshot({
format()
})
Expand All @@ -43,37 +43,64 @@ test_that("`set_char_opts()` snapshot test", {
})


# vec_ptype2.pillar_char --------------------------------------------------------------
# format.pillar_char_attr -------------------------------------------------------------

test_that("`vec_ptype2.pillar_char()` snapshot test", {
test_that("`format.pillar_char_attr()` snapshot test", {
expect_snapshot({
format()
})
})


# vec_ptype2.pillar_char.pillar_char --------------------------------------------------

test_that("`vec_ptype2.pillar_char.pillar_char()` snapshot test", {
expect_snapshot({
vec_ptype2.pillar_char()
})
})


# vec_ptype2.character ----------------------------------------------------------------
# vec_ptype2.pillar_char.character ----------------------------------------------------

test_that("`vec_ptype2.character()` snapshot test", {
test_that("`vec_ptype2.pillar_char.character()` snapshot test", {
expect_snapshot({
vec_ptype2.pillar_char()
})
})


# vec_ptype2.character.pillar_char ----------------------------------------------------

test_that("`vec_ptype2.character.pillar_char()` snapshot test", {
expect_snapshot({
vec_ptype2.character()
})
})


# vec_cast.pillar_char ----------------------------------------------------------------
# vec_cast.pillar_char.pillar_char ----------------------------------------------------

test_that("`vec_cast.pillar_char()` snapshot test", {
test_that("`vec_cast.pillar_char.pillar_char()` snapshot test", {
expect_snapshot({
vec_cast.pillar_char()
})
})


# vec_cast.character ------------------------------------------------------------------
# vec_cast.character.pillar_char ------------------------------------------------------

test_that("`vec_cast.character()` snapshot test", {
test_that("`vec_cast.character.pillar_char()` snapshot test", {
expect_snapshot({
vec_cast.character()
})
})


# vec_cast.pillar_char.character ------------------------------------------------------

test_that("`vec_cast.pillar_char.character()` snapshot test", {
expect_snapshot({
vec_cast.pillar_char()
})
})
4 changes: 2 additions & 2 deletions tests/testthat/test-continuation-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ test_that("`new_continuation_shaft()` snapshot test", {
})


# format ------------------------------------------------------------------------------
# format.pillar_continuation_shaft ----------------------------------------------------

test_that("`format()` snapshot test", {
test_that("`format.pillar_continuation_shaft()` snapshot test", {
expect_snapshot({
format()
})
Expand Down
18 changes: 18 additions & 0 deletions tests/testthat/test-ctl_new_pillar.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ test_that("`ctl_new_pillar()` snapshot test", {
})


# ctl_new_pillar.tbl ------------------------------------------------------------------

test_that("`ctl_new_pillar.tbl()` snapshot test", {
expect_snapshot({
ctl_new_pillar()
})
})


# ctl_new_rowid_pillar ----------------------------------------------------------------

test_that("`ctl_new_rowid_pillar()` snapshot test", {
Expand All @@ -16,6 +25,15 @@ test_that("`ctl_new_rowid_pillar()` snapshot test", {
})


# ctl_new_rowid_pillar.tbl ------------------------------------------------------------

test_that("`ctl_new_rowid_pillar.tbl()` snapshot test", {
expect_snapshot({
ctl_new_rowid_pillar()
})
})


# max0 --------------------------------------------------------------------------------

test_that("`max0()` snapshot test", {
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-ctl_new_pillar_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ test_that("`ctl_new_pillar_list()` snapshot test", {
})


# ctl_new_pillar_list.tbl -------------------------------------------------------------

test_that("`ctl_new_pillar_list.tbl()` snapshot test", {
expect_snapshot({
ctl_new_pillar_list()
})
})


# new_data_frame_pillar_list ----------------------------------------------------------

test_that("`new_data_frame_pillar_list()` snapshot test", {
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-ctl_pillar.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ test_that("`new_pillar()` snapshot test", {
})


# format ------------------------------------------------------------------------------
# format.pillar -----------------------------------------------------------------------

test_that("`format()` snapshot test", {
test_that("`format.pillar()` snapshot test", {
expect_snapshot({
format()
})
})


# print -------------------------------------------------------------------------------
# print.pillar ------------------------------------------------------------------------

test_that("`print()` snapshot test", {
test_that("`print.pillar()` snapshot test", {
expect_snapshot({
print()
})
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-ggplot2.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ test_that("`MakeScaleContinuousPositionNum()` snapshot test", {
})


# scale_type --------------------------------------------------------------------------
# scale_type.pillar_num ---------------------------------------------------------------

test_that("`scale_type()` snapshot test", {
test_that("`scale_type.pillar_num()` snapshot test", {
expect_snapshot({
scale_type()
})
})


# rescale -----------------------------------------------------------------------------
# rescale.pillar_num ------------------------------------------------------------------

test_that("`rescale()` snapshot test", {
test_that("`rescale.pillar_num()` snapshot test", {
expect_snapshot({
rescale()
})
Expand Down
54 changes: 54 additions & 0 deletions tests/testthat/test-glimpse.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ test_that("`glimpse()` snapshot test", {
})


# glimpse.tbl -------------------------------------------------------------------------

test_that("`glimpse.tbl()` snapshot test", {
expect_snapshot({
glimpse()
})
})


# glimpse.default ---------------------------------------------------------------------

test_that("`glimpse.default()` snapshot test", {
expect_snapshot({
glimpse()
})
})


# format_glimpse ----------------------------------------------------------------------

test_that("`format_glimpse()` snapshot test", {
Expand Down Expand Up @@ -34,6 +52,42 @@ test_that("`format_glimpse_()` snapshot test", {
})


# format_glimpse.default --------------------------------------------------------------

test_that("`format_glimpse.default()` snapshot test", {
expect_snapshot({
format_glimpse()
})
})


# format_glimpse.list -----------------------------------------------------------------

test_that("`format_glimpse.list()` snapshot test", {
expect_snapshot({
format_glimpse()
})
})


# format_glimpse.character ------------------------------------------------------------

test_that("`format_glimpse.character()` snapshot test", {
expect_snapshot({
format_glimpse()
})
})


# format_glimpse.factor ---------------------------------------------------------------

test_that("`format_glimpse.factor()` snapshot test", {
expect_snapshot({
format_glimpse()
})
})


# Legacy tests ------------------------------------------------------------------------

test_that("format_glimpse() output test", {
Expand Down
39 changes: 33 additions & 6 deletions tests/testthat/test-multi.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,27 +97,27 @@ test_that("`format_colonnade_tier()` snapshot test", {
})


# format ------------------------------------------------------------------------------
# format.pillar_squeezed_colonnade ----------------------------------------------------

test_that("`format()` snapshot test", {
test_that("`format.pillar_squeezed_colonnade()` snapshot test", {
expect_snapshot({
format()
})
})


# print -------------------------------------------------------------------------------
# print.pillar_squeezed_colonnade -----------------------------------------------------

test_that("`print()` snapshot test", {
test_that("`print.pillar_squeezed_colonnade()` snapshot test", {
expect_snapshot({
print()
})
})


# knit_print --------------------------------------------------------------------------
# knit_print.pillar_squeezed_colonnade ------------------------------------------------

test_that("`knit_print()` snapshot test", {
test_that("`knit_print.pillar_squeezed_colonnade()` snapshot test", {
expect_snapshot({
knit_print()
})
Expand All @@ -142,6 +142,15 @@ test_that("`extra_cols()` snapshot test", {
})


# extra_cols.pillar_squeezed_colonnade ------------------------------------------------

test_that("`extra_cols.pillar_squeezed_colonnade()` snapshot test", {
expect_snapshot({
extra_cols()
})
})


# extra_cols_impl ---------------------------------------------------------------------

test_that("`extra_cols_impl()` snapshot test", {
Expand All @@ -151,6 +160,24 @@ test_that("`extra_cols_impl()` snapshot test", {
})


# format.pillar_colonnade -------------------------------------------------------------

test_that("`format.pillar_colonnade()` snapshot test", {
expect_snapshot({
format()
})
})


# print.pillar_colonnade --------------------------------------------------------------

test_that("`print.pillar_colonnade()` snapshot test", {
expect_snapshot({
print()
})
})


# colonnade_get_width -----------------------------------------------------------------

test_that("`colonnade_get_width()` snapshot test", {
Expand Down
Loading

0 comments on commit 2f7d830

Please sign in to comment.