Skip to content

Commit 1a6e495

Browse files
Fix some lints in the tests folder (#6051)
* fix more lints * revert any(duplicated()) changes
1 parent d8eb945 commit 1a6e495

26 files changed

+151
-152
lines changed

tests/testthat/test-aes-calculated.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test_that("names surrounded by .. is calculated", {
66
expect_equal(is_calculated_aes(aes(..x.., ..x, x..)), c(TRUE, FALSE, FALSE))
77

88
# even when nested
9-
expect_equal(is_calculated_aes(aes(f(..x..))), TRUE)
9+
expect_true(is_calculated_aes(aes(f(..x..))))
1010
})
1111

1212
test_that("call to stat() is calculated", {

tests/testthat/test-aes-grouping.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test_that("no error for aes(groupS)", {
2626
g <- add_group(df2)
2727

2828
expect_equal(nrow(g), nrow(df2))
29-
expect_equal(names(g), c("x", "y", "groupS", "group"))
29+
expect_named(g, c("x", "y", "groupS", "group"))
3030
})
3131

3232
test_that("label is not used as a grouping var", {

tests/testthat/test-coord-.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ test_that("guide names are not removed by `train_panel_guides()`", {
3737
layout$setup_panel_guides(guides_list(NULL), plot$layers)
3838

3939
# Line showing change in outcome
40-
expect_equal(names(layout$panel_params[[1]]$guides$aesthetics),
41-
c("x", "y", "x.sec", "y.sec"))
40+
expect_named(layout$panel_params[[1]]$guides$aesthetics, c("x", "y", "x.sec", "y.sec"))
4241
})
4342

4443
test_that("check coord limits errors only on bad inputs", {

tests/testthat/test-coord-polar.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
test_that("polar distance is calculated correctly", {
22
dat <- data_frame(
33
theta = c(0, 2*pi, 2, 6, 6, 1, 1, 0),
4-
r = c(0, 0, 0.5, 0.5, 1, 1, 0.75, .5))
4+
r = c(0, 0, 0.5, 0.5, 1, 1, 0.75, 0.5))
55

66
scales <- list(
77
x = scale_x_continuous(limits = c(0, 2*pi)),
@@ -176,7 +176,7 @@ test_that("polar coordinates draw correctly", {
176176

177177
dat <- data_frame(
178178
theta = c(0, 2*pi, 2, 6, 6, 1, 1, 0),
179-
r = c(0, 0, 0.5, 0.5, 1, 1, 0.75, .5),
179+
r = c(0, 0, 0.5, 0.5, 1, 1, 0.75, 0.5),
180180
g = 1:8
181181
)
182182
expect_doppelganger("Rays, circular arcs, and spiral arcs",

tests/testthat/test-coord-train.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test_that("NA's don't appear in breaks", {
55
ns <- names(trained)[grepl("(\\.major)|(\\.minor)$", names(trained))]
66

77
for (n in ns) {
8-
if (!is.null(trained[n]) && any(is.na(trained[n])))
8+
if (!is.null(trained[n]) && anyNA(trained[n]))
99
return(TRUE)
1010
}
1111

@@ -19,8 +19,8 @@ test_that("NA's don't appear in breaks", {
1919
# This is a test to make sure the later tests will be useful!
2020
# It's possible that changes to the way that breaks are calculated will
2121
# make it so that scale_break_positions will no longer give NA for range 1, 12
22-
expect_true(any(is.na(scale_x$break_positions())))
23-
expect_true(any(is.na(scale_y$break_positions())))
22+
expect_true(anyNA(scale_x$break_positions()))
23+
expect_true(anyNA(scale_y$break_positions()))
2424

2525
# Check the various types of coords to make sure they don't have NA breaks
2626
expect_false(any_NA_major_minor(coord_polar()$setup_panel_params(scale_x, scale_y)))

tests/testthat/test-coord_sf.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ test_that("sf_transform_xy() works", {
309309
# transform back
310310
out2 <- sf_transform_xy(out, 4326, 3347)
311311
expect_identical(data$city, out2$city)
312-
expect_true(all(abs(out2$x - data$x) < .01))
313-
expect_true(all(abs(out2$y - data$y) < .01))
312+
expect_true(all(abs(out2$x - data$x) < 0.01))
313+
expect_true(all(abs(out2$y - data$y) < 0.01))
314314

315315
})
316316

tests/testthat/test-empty-data.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ test_that("empty layers still generate one grob per panel", {
8888
geom_point() +
8989
facet_wrap(~y)
9090

91-
expect_equal(length(get_layer_grob(d)), 3)
91+
expect_length(get_layer_grob(d), 3)
9292
})
9393

9494
test_that("missing layers generate one grob per panel", {
9595
df <- data_frame(x = 1:4, y = rep(1:2, 2), g = rep(1:2, 2))
9696
base <- ggplot(df, aes(x, y)) + geom_point(shape = NA, na.rm = TRUE)
9797

98-
expect_equal(length(get_layer_grob(base)), 1)
99-
expect_equal(length(get_layer_grob(base + facet_wrap(~ g))), 2)
98+
expect_length(get_layer_grob(base), 1)
99+
expect_length(get_layer_grob(base + facet_wrap(~ g)), 2)
100100
})

tests/testthat/test-facet-strips.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,24 +143,24 @@ test_that("padding is only added if axis is present", {
143143
strip.switch.pad.grid = unit(10, "mm")
144144
)
145145
pg <- ggplotGrob(p)
146-
expect_equal(length(pg$heights), 19)
147-
expect_equal(length(pg$widths), 18)
146+
expect_length(pg$heights, 19)
147+
expect_length(pg$widths, 18)
148148

149149
pg <- ggplotGrob(
150150
p + scale_x_continuous(position = "top") +
151151
scale_y_continuous(position = "right")
152152
)
153-
expect_equal(length(pg$heights), 20)
153+
expect_length(pg$heights, 20)
154154
expect_equal(as.character(pg$heights[9]), "1cm")
155-
expect_equal(length(pg$widths), 19)
155+
expect_length(pg$widths, 19)
156156
expect_equal(as.character(pg$widths[13]), "1cm")
157157

158158
# Also add padding with negative ticks and no text (#5251)
159159
pg <- ggplotGrob(
160160
p + scale_x_continuous(labels = NULL, position = "top") +
161161
theme(axis.ticks.length.x.top = unit(-2, "mm"))
162162
)
163-
expect_equal(length(pg$heights), 20)
163+
expect_length(pg$heights, 20)
164164
expect_equal(as.character(pg$heights[9]), "1cm")
165165

166166
# Inverse should be true when strips are switched
@@ -172,17 +172,17 @@ test_that("padding is only added if axis is present", {
172172
)
173173

174174
pg <- ggplotGrob(p)
175-
expect_equal(length(pg$heights), 20)
175+
expect_length(pg$heights, 20)
176176
expect_equal(as.character(pg$heights[13]), "1cm")
177-
expect_equal(length(pg$widths), 19)
177+
expect_length(pg$widths, 19)
178178
expect_equal(as.character(pg$widths[7]), "1cm")
179179

180180
pg <- ggplotGrob(
181181
p + scale_x_continuous(position = "top") +
182182
scale_y_continuous(position = "right")
183183
)
184-
expect_equal(length(pg$heights), 19)
185-
expect_equal(length(pg$widths), 18)
184+
expect_length(pg$heights, 19)
185+
expect_length(pg$widths, 18)
186186
})
187187

188188
test_that("y strip labels are rotated when strips are switched", {

tests/testthat/test-fortify.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test_that("spatial polygons have correct ordering", {
1111
y - dely,y - dely,y + dely,y + dely,y - dely), ncol = 2))
1212
}
1313

14-
make_hole <- function(x = 0, y = 0, height = .5, width = .5){
14+
make_hole <- function(x = 0, y = 0, height = 0.5, width = 0.5){
1515
p <- make_square(x = x, y = y, height = height, width = width)
1616
p@hole <- TRUE
1717
p

tests/testthat/test-geom-dotplot.R

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test_that("dodging works", {
1717
ndodge <- 3
1818

1919
# The amount of space allocated within each dodge group
20-
dwidth <- .9 / ndodge
20+
dwidth <- 0.9 / ndodge
2121

2222
# This should be the x position for each before dodging
2323
xbase <- ceiling(df$group / ndodge)
@@ -36,20 +36,20 @@ test_that("dodging works", {
3636

3737
test_that("binning works", {
3838
bp <- ggplot(dat, aes(y)) +
39-
geom_dotplot(binwidth = .4, method = "histodot")
39+
geom_dotplot(binwidth = 0.4, method = "histodot")
4040
x <- get_layer_data(bp)$x
4141

4242
# Need ugly hack to make sure mod function doesn't give values like -3.99999
4343
# due to floating point error
44-
expect_true(all(abs((x - min(x) + 1e-7) %% .4) < 1e-6))
44+
expect_true(all(abs((x - min(x) + 1e-7) %% 0.4) < 1e-6))
4545

4646
bp <- ggplot(dat, aes(x = y)) +
47-
geom_dotplot(binwidth = .4, method = "dotdensity")
47+
geom_dotplot(binwidth = 0.4, method = "dotdensity")
4848
x <- get_layer_data(bp)$x
4949

5050
# This one doesn't ensure that dotdensity works, but it does check that it's not
5151
# doing fixed bin sizes
52-
expect_false(all(abs((x - min(x) + 1e-7) %% .4) < 1e-6))
52+
expect_false(all(abs((x - min(x) + 1e-7) %% 0.4) < 1e-6))
5353
})
5454

5555
test_that("NA's result in warning from stat_bindot", {
@@ -58,7 +58,7 @@ test_that("NA's result in warning from stat_bindot", {
5858
dat$x[c(2,10)] <- NA
5959

6060
# Need to assign it to a var here so that it doesn't automatically print
61-
expect_snapshot_warning(ggplot_build(ggplot(dat, aes(x)) + geom_dotplot(binwidth = .2)))
61+
expect_snapshot_warning(ggplot_build(ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.2)))
6262
})
6363

6464
test_that("when binning on y-axis, limits depend on the panel", {
@@ -92,99 +92,99 @@ test_that("geom_dotplot draws correctly", {
9292

9393
# Basic dotplot with binning along x axis
9494
expect_doppelganger("basic dotplot with dot-density binning, binwidth = .4",
95-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4)
95+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4)
9696
)
9797
expect_doppelganger("histodot binning (equal bin spacing)",
98-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, method = "histodot")
98+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, method = "histodot")
9999
)
100100
expect_doppelganger("dots stacked closer: stackratio=.5, fill=white",
101-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackratio = .5, fill = "white")
101+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, stackratio = 0.5, fill = "white")
102102
)
103103
expect_doppelganger("larger dots: dotsize=1.5, fill=white",
104-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, dotsize = 1.4, fill = "white")
104+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, dotsize = 1.4, fill = "white")
105105
)
106106

107107
# Stacking methods
108108
expect_doppelganger("stack up",
109-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "up")
109+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, stackdir = "up")
110110
)
111111
expect_doppelganger("stack down",
112-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "down")
112+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, stackdir = "down")
113113
)
114114
expect_doppelganger("stack center",
115-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "center")
115+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, stackdir = "center")
116116
)
117117
expect_doppelganger("stack centerwhole",
118-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "centerwhole")
118+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, stackdir = "centerwhole")
119119
)
120120

121121
# Stacking methods with coord_flip
122122
expect_doppelganger("stack up with coord_flip",
123-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "up") + coord_flip()
123+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, stackdir = "up") + coord_flip()
124124
)
125125
expect_doppelganger("stack down with coord_flip",
126-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "down") + coord_flip()
126+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, stackdir = "down") + coord_flip()
127127
)
128128
expect_doppelganger("stack center with coord_flip",
129-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "center") + coord_flip()
129+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, stackdir = "center") + coord_flip()
130130
)
131131
expect_doppelganger("stack centerwhole with coord_flip",
132-
ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "centerwhole") + coord_flip()
132+
ggplot(dat, aes(x)) + geom_dotplot(binwidth = 0.4, stackdir = "centerwhole") + coord_flip()
133133
)
134134

135135
# Binning along x, with groups
136136
expect_doppelganger("multiple groups, bins not aligned",
137-
ggplot(dat, aes(x, fill = g)) + geom_dotplot(binwidth = .4, alpha = .4)
137+
ggplot(dat, aes(x, fill = g)) + geom_dotplot(binwidth = 0.4, alpha = 0.4)
138138
)
139139
expect_doppelganger("multiple groups, bins aligned",
140-
ggplot(dat, aes(x, fill = g)) + geom_dotplot(binwidth = .4, alpha = .4, binpositions = "all")
140+
ggplot(dat, aes(x, fill = g)) + geom_dotplot(binwidth = 0.4, alpha = 0.4, binpositions = "all")
141141
)
142142

143143
# Binning along y axis
144144
expect_doppelganger("bin along y, stack center",
145-
ggplot(dat, aes(0, x)) + geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "center")
145+
ggplot(dat, aes(0, x)) + geom_dotplot(binwidth = 0.4, binaxis = "y", stackdir = "center")
146146
)
147147
expect_doppelganger("bin along y, stack centerwhole",
148-
ggplot(dat, aes(0, x)) + geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "centerwhole")
148+
ggplot(dat, aes(0, x)) + geom_dotplot(binwidth = 0.4, binaxis = "y", stackdir = "centerwhole")
149149
)
150150
expect_doppelganger("bin along y, stack centerwhole, histodot",
151-
ggplot(dat, aes(0, x)) + geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "centerwhole", method = "histodot")
151+
ggplot(dat, aes(0, x)) + geom_dotplot(binwidth = 0.4, binaxis = "y", stackdir = "centerwhole", method = "histodot")
152152
)
153153

154154
# Binning along y, with multiple grouping factors
155155
dat2 <- data_frame(x = rep(factor(LETTERS[1:3]), 30), y = rnorm(90), g = rep(factor(LETTERS[1:2]), 45))
156156

157157
expect_doppelganger("bin x, three y groups, stack centerwhole",
158-
ggplot(dat2, aes(y, x)) + geom_dotplot(binwidth = .25, binaxis = "x", stackdir = "centerwhole")
158+
ggplot(dat2, aes(y, x)) + geom_dotplot(binwidth = 0.25, binaxis = "x", stackdir = "centerwhole")
159159
)
160160
expect_doppelganger("bin y, three x groups, stack centerwhole",
161-
ggplot(dat2, aes(x, y)) + geom_dotplot(binwidth = .25, binaxis = "y", stackdir = "centerwhole")
161+
ggplot(dat2, aes(x, y)) + geom_dotplot(binwidth = 0.25, binaxis = "y", stackdir = "centerwhole")
162162
)
163163
expect_doppelganger("bin y, three x groups, bins aligned across groups",
164-
ggplot(dat2, aes(x, y)) + geom_dotplot(binwidth = .25, binaxis = "y", stackdir = "center", binpositions = "all")
164+
ggplot(dat2, aes(x, y)) + geom_dotplot(binwidth = 0.25, binaxis = "y", stackdir = "center", binpositions = "all")
165165
)
166166
expect_doppelganger("bin y, three x groups, bins aligned, coord_flip",
167-
ggplot(dat2, aes(x, y)) + geom_dotplot(binwidth = .25, binaxis = "y", stackdir = "center", binpositions = "all") +
167+
ggplot(dat2, aes(x, y)) + geom_dotplot(binwidth = 0.25, binaxis = "y", stackdir = "center", binpositions = "all") +
168168
coord_flip()
169169
)
170170
expect_doppelganger("bin y, dodged",
171-
ggplot(dat2, aes("foo", y, fill = x)) + scale_y_continuous(breaks = seq(-4, 4, .4)) +
172-
geom_dotplot(binwidth = .25, position = "dodge", binaxis = "y", stackdir = "center")
171+
ggplot(dat2, aes("foo", y, fill = x)) + scale_y_continuous(breaks = seq(-4, 4, 0.4)) +
172+
geom_dotplot(binwidth = 0.25, position = "dodge", binaxis = "y", stackdir = "center")
173173
)
174174
expect_doppelganger("bin y, dodged, coord_flip",
175-
ggplot(dat2, aes("foo", y, fill = x)) + scale_y_continuous(breaks = seq(-4, 4, .4)) +
176-
geom_dotplot(binwidth = .25, position = "dodge", binaxis = "y", stackdir = "center") +
175+
ggplot(dat2, aes("foo", y, fill = x)) + scale_y_continuous(breaks = seq(-4, 4, 0.4)) +
176+
geom_dotplot(binwidth = 0.25, position = "dodge", binaxis = "y", stackdir = "center") +
177177
coord_flip()
178178
)
179179
expect_doppelganger("bin y, three x groups, fill and dodge",
180-
ggplot(dat2, aes(x, y, fill = g)) + scale_y_continuous(breaks = seq(-4 ,4, .4)) +
181-
geom_dotplot(binwidth = .2, position = "dodge", binaxis = "y", stackdir = "center")
180+
ggplot(dat2, aes(x, y, fill = g)) + scale_y_continuous(breaks = seq(-4 ,4, 0.4)) +
181+
geom_dotplot(binwidth = 0.2, position = "dodge", binaxis = "y", stackdir = "center")
182182
)
183183
expect_doppelganger("bin y, continous x-axis, grouping by x",
184-
ggplot(dat2, aes(as.numeric(x), y, group = x)) + geom_dotplot(binwidth = .2, binaxis = "y", stackdir = "center")
184+
ggplot(dat2, aes(as.numeric(x), y, group = x)) + geom_dotplot(binwidth = 0.2, binaxis = "y", stackdir = "center")
185185
)
186186
expect_doppelganger("bin y, continous x-axis, single x group",
187-
ggplot(dat2, aes(as.numeric(x), y)) + geom_dotplot(binwidth = .2, binaxis = "y", stackdir = "center")
187+
ggplot(dat2, aes(as.numeric(x), y)) + geom_dotplot(binwidth = 0.2, binaxis = "y", stackdir = "center")
188188
)
189189

190190
# border width and size
@@ -198,31 +198,31 @@ test_that("geom_dotplot draws correctly", {
198198
stroke = rep(c(1, 2), length.out = nrow(dat))
199199
)
200200
) +
201-
geom_dotplot(binwidth = .4, fill = "red", col = "blue") +
201+
geom_dotplot(binwidth = 0.4, fill = "red", col = "blue") +
202202
continuous_scale("stroke", palette = function(x) scales::rescale(x, to = c(1, 6))) +
203203
guides(linetype = guide_legend(order = 1))
204204
)
205205

206206
# Stacking groups
207207
expect_doppelganger("3 stackgroups, dot-density with aligned bins",
208-
ggplot(dat2, aes(y, fill = x)) + geom_dotplot(binwidth = .25, stackgroups = TRUE, binpositions = "all", alpha = 0.5)
208+
ggplot(dat2, aes(y, fill = x)) + geom_dotplot(binwidth = 0.25, stackgroups = TRUE, binpositions = "all", alpha = 0.5)
209209
)
210210
expect_doppelganger("3 stackgroups, histodot",
211-
ggplot(dat2, aes(y, fill = x)) + geom_dotplot(binwidth = .25, stackgroups = TRUE, method = "histodot", alpha = 0.5)
211+
ggplot(dat2, aes(y, fill = x)) + geom_dotplot(binwidth = 0.25, stackgroups = TRUE, method = "histodot", alpha = 0.5)
212212
)
213213
expect_doppelganger("3 stackgroups, bin y, histodot",
214-
ggplot(dat2, aes(1, y, fill = x)) + geom_dotplot(binaxis = "y", binwidth = .25, stackgroups = TRUE, method = "histodot", alpha = 0.5)
214+
ggplot(dat2, aes(1, y, fill = x)) + geom_dotplot(binaxis = "y", binwidth = 0.25, stackgroups = TRUE, method = "histodot", alpha = 0.5)
215215
)
216216

217217
# This one is currently broken but it would be a really rare case, and it
218218
# probably requires a really ugly hack to fix
219219
expect_doppelganger("bin y, dodging, 3 stackgroups, histodot",
220220
ggplot(dat2, aes(x, y, fill = g)) +
221-
geom_dotplot(binaxis = "y", binwidth = .25, stackgroups = TRUE, method = "histodot",
221+
geom_dotplot(binaxis = "y", binwidth = 0.25, stackgroups = TRUE, method = "histodot",
222222
alpha = 0.5, stackdir = "centerwhole")
223223
)
224224
expect_doppelganger("facets, 3 groups, histodot, stackgroups",
225-
ggplot(dat2, aes(y, fill = g)) + geom_dotplot(binwidth = .25, stackgroups = TRUE, method = "histodot", alpha = 0.5) +
225+
ggplot(dat2, aes(y, fill = g)) + geom_dotplot(binwidth = 0.25, stackgroups = TRUE, method = "histodot", alpha = 0.5) +
226226
facet_grid(x ~ .)
227227
)
228228

@@ -231,10 +231,10 @@ test_that("geom_dotplot draws correctly", {
231231
dat2$x[c(1, 10)] <- NA
232232

233233
expect_warning(expect_doppelganger("2 NA values, dot-density binning, binwidth = .4",
234-
ggplot(dat2, aes(x)) + geom_dotplot(binwidth = .4)
234+
ggplot(dat2, aes(x)) + geom_dotplot(binwidth = 0.4)
235235
))
236236
expect_warning(expect_doppelganger("2 NA values, bin along y, stack center",
237-
ggplot(dat2, aes(0, x)) + geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "center")
237+
ggplot(dat2, aes(0, x)) + geom_dotplot(binwidth = 0.4, binaxis = "y", stackdir = "center")
238238
))
239239
})
240240

tests/testthat/test-geom-path.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
test_that("keep_mid_true drops leading/trailing FALSE", {
2-
expect_equal(keep_mid_true(c(F, F)), c(F, F))
3-
expect_equal(keep_mid_true(c(F, T, F, T, F)), c(F, T, T, T, F))
4-
expect_equal(keep_mid_true(c(T, T, F, T, F)), c(T, T, T, T, F))
5-
expect_equal(keep_mid_true(c(F, T, F, T, T)), c(F, T, T, T, T))
2+
expect_equal(keep_mid_true(c(FALSE, FALSE)), c(FALSE, FALSE))
3+
expect_equal(keep_mid_true(c(FALSE, TRUE, FALSE, TRUE, FALSE)), c(FALSE, TRUE, TRUE, TRUE, FALSE))
4+
expect_equal(keep_mid_true(c(TRUE, TRUE, FALSE, TRUE, FALSE)), c(TRUE, TRUE, TRUE, TRUE, FALSE))
5+
expect_equal(keep_mid_true(c(FALSE, TRUE, FALSE, TRUE, TRUE)), c(FALSE, TRUE, TRUE, TRUE, TRUE))
66
})
77

88
test_that("geom_path() throws meaningful error on bad combination of varying aesthetics", {

0 commit comments

Comments
 (0)