Skip to content

Commit ac39945

Browse files
author
Lindsay Carr
committed
added test for static lists of overall and function-specific legend arguments
1 parent 3168b40 commit ac39945

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/testthat/test-legend.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ test_that("gsplot legend works", {
2323

2424
expect_equal(gs$legend$gs.config$location, "bottomright")
2525

26+
})
27+
28+
test_that("gsplot legend args are still the same", {
29+
30+
overall.legend <- c("x", "y", "bty", "bg", "box.lty", "box.lwd", "box.col", "cex",
31+
"xjust", "yjust", "x.intersp", "y.intersp", "adj", "text.width",
32+
"merge", "trace", "plot", "ncol", "horiz", "title", "inset",
33+
"xpd", "title.col", "title.adj", "seg.len")
34+
35+
fun.specific <- c("legend", "fill", "col", "border", "lty", "lwd", "pch", "angle",
36+
"density", "pt.bg", "pt.cex", "pt.lwd", "text.col", "text.font")
37+
38+
all.formals <- names(formals(graphics::legend))
39+
40+
expect_equal(length(all.formals[!all.formals %in% overall.legend]), length(fun.specific))
41+
42+
expect_equal(length(all.formals[!all.formals %in% fun.specific]), length(overall.legend))
2643

2744
})
2845

0 commit comments

Comments
 (0)