Skip to content

Commit

Permalink
Testing CodeCov metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlandis committed Feb 28, 2024
1 parent e539da7 commit b15edc6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/testthat/test_add_gg.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ test_that("Overwritten `+.gg` still adds layers as expected",{
expect_false(identical(p3$scales,p4$scales))
})

p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
geom_point()

test_that("New ggside layers are added correctly",{
p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
geom_point()
expect_s3_class(p, "ggplot")
expect_s3_class(ggside(), "ggside_options")
p1 <- p + geom_xsidedensity(aes(y=after_stat(density)))
Expand All @@ -39,3 +40,18 @@ test_that("New ggside layers are added correctly",{
})


test_that("add_gg errors", {
expect_error(+p, "with a single argument. Did you accidentally put")
expect_error({ggside:::add_gg("character", p, "a character")}, "no applicable method for 'add_gg'")
expect_error("" + p, "No method defined for class character")
fake_theme <- structure(numeric(), class = "theme")
expect_error(theme() + fake_theme, "to a theme object")
expect_error(ggproto() + p, "Cannot add ggproto objects together")
})

test_that("add_gg identities", {
expect_identical(p + NULL, p)
expect_identical(theme() + theme_bw(), theme_bw())
})


0 comments on commit b15edc6

Please sign in to comment.