Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Sep 4, 2024
1 parent cfd12e5 commit 45a769d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/_snaps/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,19 @@

Can't recycle `..1` (size 4) to match `..2` (size 0).

# summary method gives a nice summary

Code
summary(p)
Output
data: manufacturer, model, displ, year, cyl, trans, drv, cty, hwy, fl,
class [234x11]
mapping: x = ~displ, y = ~hwy, colour = ~drv
scales: x, xmin, xmax, xend, xintercept, xmin_final, xmax_final, xlower, xmiddle, xupper, x0, colour
faceting: ~year, ~cyl
-----------------------------------
geom_point: na.rm = FALSE
stat_identity: na.rm = FALSE
position_identity

13 changes: 13 additions & 0 deletions tests/testthat/test-utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,16 @@ test_that("expose/ignore_data() can round-trip a data.frame", {
expect_equal(test, df[, c("a", "c", "b", "d")])

})

test_that("summary method gives a nice summary", {
# This test isn't important enough to break anything on CRAN
skip_on_cran()

p <- ggplot(mpg, aes(displ, hwy, colour = drv)) +
geom_point() +
scale_x_continuous() +
scale_colour_brewer() +
facet_grid(year ~ cyl)

expect_snapshot(summary(p))
})

0 comments on commit 45a769d

Please sign in to comment.