Skip to content

Commit ad3dbfc

Browse files
Use testthat 3e (#4522)
1 parent 4c1c8df commit ad3dbfc

File tree

95 files changed

+123
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+123
-258
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Suggests:
6464
rpart,
6565
sf (>= 0.7-3),
6666
svglite (>= 1.2.0.9001),
67-
testthat (>= 2.1.0),
67+
testthat (>= 3.0.0),
6868
vdiffr (>= 1.0.0),
6969
xml2
7070
Enhances: sp
@@ -274,3 +274,4 @@ Config/Needs/website:
274274
tidyr,
275275
forcats,
276276
tidyverse/tidytemplate
277+
Config/testthat/edition: 3

tests/testthat/test-add.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("Adding plot elements")
2-
31
test_that("mapping class is preserved when adding uneval objects", {
42
p <- ggplot(mtcars) + aes(wt, mpg)
53
expect_identical(class(p$mapping), "uneval")

tests/testthat/test-aes-calculated.r

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("test-aes-calculated.r")
2-
31
test_that("constants aren't calculated", {
42
expect_equal(is_calculated_aes(aes(1, "a", TRUE)), c(FALSE, FALSE, FALSE))
53
})

tests/testthat/test-aes-grouping.r

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("Aesthetics (grouping)")
2-
31
df <- data_frame(
42
x = 1:4,
53
a = c("a", "a", "b", "b"),

tests/testthat/test-aes-setting.r

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("Aes - setting values")
2-
31
test_that("aesthetic parameters match length of data", {
42
df <- data_frame(x = 1:5, y = 1:5)
53
p <- ggplot(df, aes(x, y))

tests/testthat/test-aes.r

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("Creating aesthetic mappings")
2-
31
test_that("aes() captures input expressions", {
42
out <- aes(mpg, wt + 1)
53
expect_identical(out$x, quo(mpg))
@@ -36,7 +34,9 @@ test_that("aes_q() & aes_string() preserve explicit NULLs", {
3634
test_that("aes_all() converts strings into mappings", {
3735
expect_equal(
3836
aes_all(c("x", "y", "col", "pch")),
39-
aes(x, y, colour = col, shape = pch)
37+
aes(x, y, colour = col, shape = pch),
38+
# ignore the environments of quosures
39+
ignore_attr = TRUE
4040
)
4141
})
4242

tests/testthat/test-annotate.r

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("annotate")
2-
31
test_that("dates in segment annotation work", {
42
dt <- structure(list(month = structure(c(1364774400, 1377993600),
53
class = c("POSIXct", "POSIXt"), tzone = "UTC"), total = c(-10.3,

tests/testthat/test-build.r

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Test the complete path from plot specification to rendered data
2-
context("Plot building")
3-
42
df <- data_frame(x = 1:3, y = 3:1, z = letters[1:3])
53

64
test_that("there is one data frame for each layer", {
@@ -19,8 +17,8 @@ test_that("position aesthetics are coerced to correct type", {
1917
l1 <- ggplot(df, aes(x, y)) + geom_point()
2018
d1 <- layer_data(l1, 1)
2119

22-
expect_is(d1$x, "numeric")
23-
expect_is(d1$y, "numeric")
20+
expect_type(d1$x, "double")
21+
expect_type(d1$y, "double")
2422

2523
l2 <- ggplot(df, aes(x, z)) + geom_point() + scale_x_discrete()
2624
d2 <- layer_data(l2, 1)
@@ -52,5 +50,5 @@ test_that("strings are not converted to factors", {
5250
p <- ggplot(df, aes(x, y)) +
5351
geom_text(aes(label = label), parse = TRUE)
5452

55-
expect_is(layer_data(p)$label, "character")
53+
expect_type(layer_data(p)$label, "character")
5654
})

tests/testthat/test-coord-.r

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("test-coord-.r")
2-
31
test_that("clipping is on by default", {
42
p <- ggplot()
53
coord <- ggplot_build(p)$layout$coord

tests/testthat/test-coord-cartesian.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("coord_cartesian")
2-
31
test_that("clipping can be turned off and on", {
42
# clip on by default
53
p <- ggplot() + coord_cartesian()

0 commit comments

Comments
 (0)