Skip to content

Commit

Permalink
fix skip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tdhock committed Nov 2, 2023
1 parent 610cab3 commit 25e6596
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
23 changes: 9 additions & 14 deletions tests/testthat/test-compiler-layer.r
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ test_that("aesthetics go in aes_params", {
expect_equal(l$aes_params, list(size = "red"))
})

test_that("unknown params create error", {
skip("passes when validate_params=FALSE")
expect_error(geom_point(blah = "red"), "Unknown parameters")
})

test_that("Unknown params create error with validate_params = TRUE", {
expect_error(geom_point(blah = "red", validate_params = TRUE),
"Unknown parameters")
Expand All @@ -33,21 +28,21 @@ test_that("Unknown params go in extra_params, not aes_params", {
# Calculated aesthetics ---------------------------------------------------

test_that("Bare name surround by .. is calculated", {
expect_true(is_calculated_aes(aes(..density..)))
expect_true(is_calculated_aes(aes(..DENSITY..)))
expect_false(is_calculated_aes(aes(a..x..b)))
expect_true(animint2:::is_calculated_aes(aes(..density..)))
expect_true(animint2:::is_calculated_aes(aes(..DENSITY..)))
expect_false(animint2:::is_calculated_aes(aes(a..x..b)))
})

test_that("Calling using variable surround by .. is calculated", {
expect_true(is_calculated_aes(aes(mean(..density..))))
expect_true(is_calculated_aes(aes(mean(..DENSITY..))))
expect_false(is_calculated_aes(aes(mean(a..x..b))))
expect_true(animint2:::is_calculated_aes(aes(mean(..density..))))
expect_true(animint2:::is_calculated_aes(aes(mean(..DENSITY..))))
expect_false(animint2:::is_calculated_aes(aes(mean(a..x..b))))
})

test_that("strip_dots remove dots around calculated aesthetics", {
expect_equal(strip_dots(aes(..density..))$x, quote(density))
expect_equal(strip_dots(aes(mean(..density..)))$x, quote(mean(density)))
expect_equal(strip_dots(aes(sapply(..density.., function(x) mean(x)))$x),
expect_equal(animint2:::strip_dots(aes(..density..))$x, quote(density))
expect_equal(animint2:::strip_dots(aes(mean(..density..)))$x, quote(mean(density)))
expect_equal(animint2:::strip_dots(aes(sapply(..density.., function(x) mean(x)))$x),
quote(sapply(density, function(x) mean(x))))
})

Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-compiler-plot-named-timexxx.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ viz <-
duration=list(year=1000))

test_that("plot named timeSeries is OK without time option list", {
animint2dir(viz, open.browser=FALSE)
meta <- animint2dir(viz, open.browser=FALSE)
expect_is(meta, "environment")
})

viz.time <- viz
viz.time$time <- list(ms=2000, variable="year")

test_that("plot named timeSeries is OK with time option list", {
animint2dir(viz.time, open.browser=FALSE)
meta <- animint2dir(viz.time, open.browser=FALSE)
expect_is(meta, "environment")
})

bad <-
Expand Down
9 changes: 0 additions & 9 deletions tests/testthat/test-compiler-stat-bin.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ context("stat_bin/stat_count")

test_that("stat_bin throws error when y aesthetic present", {
dat <- data.frame(x = c("a", "b", "c"), y = c(1, 5, 10))

expect_error(ggplot_build(ggplot(dat, aes(x, y)) + stat_bin()),
"must not be used with a y aesthetic.")

skip("passes when validate_params=TRUE")
expect_error(p <- ggplot_build(ggplot(dat, aes(x)) + stat_bin(y = 5)),
"Unknown parameters: y")
})

test_that("bins specifies the number of bins", {
Expand Down Expand Up @@ -97,12 +92,8 @@ test_that("weights are added", {

test_that("stat_count throws error when y aesthetic present", {
dat <- data.frame(x = c("a", "b", "c"), y = c(1, 5, 10))

expect_error(ggplot_build(ggplot(dat, aes(x, y)) + stat_count()),
"must not be used with a y aesthetic.")
skip("passes when validate_params=TRUE")
expect_error(p <- ggplot_build(ggplot(dat, aes(x)) + stat_count(y = 5)),
"Unknown parameters: y")
})

test_that("stat_count preserves x order for continuous and discrete", {
Expand Down

0 comments on commit 25e6596

Please sign in to comment.