@@ -13,28 +13,19 @@ test_that("geom_boxplot range includes all outliers", {
13
13
})
14
14
15
15
test_that(" geom_boxplot for continuous x gives warning if more than one x (#992)" , {
16
- dat <- expand.grid(x = 1 : 2 , y = c(- (1 : 20 )^ 3 , (1 : 20 )^ 3 ) )
17
- expect_that(ggplot_build(ggplot(dat , aes(x ,y )) + geom_boxplot()),
18
- gives_warning(" Continuous x aesthetic" ))
16
+ dat <- expand.grid(x = 1 : 2 , y = c(- (1 : 5 ) ^ 3 , (1 : 5 ) ^ 3 ) )
19
17
20
- expect_that(ggplot_build(ggplot(dat , aes(x = as.Date(x ,origin = Sys.Date()),y )) + geom_boxplot()),
21
- gives_warning(" Continuous x aesthetic" ))
18
+ bplot <- function (aes = NULL , extra = list ()) {
19
+ ggplot_build(ggplot(dat , aes ) + geom_boxplot(aes ) + extra )
20
+ }
22
21
23
- expect_that(ggplot_build(ggplot(dat , aes(x ,y ,group = x )) + geom_boxplot()),
24
- not(gives_warning(" Continuous x aesthetic" )))
22
+ expect_warning(bplot(aes(x , y )), " Continuous x aesthetic" )
23
+ expect_warning(bplot(aes(x , y ), facet_wrap(~ x )), " Continuous x aesthetic" )
24
+ expect_warning(bplot(aes(Sys.Date() + x , y )), " Continuous x aesthetic" )
25
25
26
- expect_that(ggplot_build(ggplot(dat , aes(x = 1 ,y )) + geom_boxplot()),
27
- not(gives_warning(" Continuous x aesthetic" )))
28
-
29
- expect_that(ggplot_build(ggplot(dat , aes(x = factor (x ),y )) + geom_boxplot()),
30
- not(gives_warning(" Continuous x aesthetic" )))
31
-
32
- expect_that(ggplot_build(ggplot(dat , aes(x = (x == 1 ),y )) + geom_boxplot()),
33
- not(gives_warning(" Continuous x aesthetic" )))
34
-
35
- expect_that(ggplot_build(ggplot(dat , aes(x = as.character(x ),y )) + geom_boxplot()),
36
- not(gives_warning(" Continuous x aesthetic" )))
37
-
38
- expect_that(ggplot_build(ggplot(dat , aes(x ,y )) + geom_boxplot() + facet_wrap(~ y )),
39
- gives_warning(" Continuous x aesthetic" ))
26
+ expect_warning(bplot(aes(x , group = x , y )), NA )
27
+ expect_warning(bplot(aes(1 , y )), NA )
28
+ expect_warning(bplot(aes(factor (x ), y )), NA )
29
+ expect_warning(bplot(aes(x == 1 , y )), NA )
30
+ expect_warning(bplot(aes(as.character(x ), y )), NA )
40
31
})
0 commit comments