Skip to content

Commit 1cc1702

Browse files
committed
add test for consistency of updatable params field
1 parent 226d86b commit 1cc1702

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/testthat/test-scales.R

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,27 @@ test_that("scale updating mechanism works", {
792792
expect_equal(l$.label, as.character(c(3, 5)), ignore_attr = "pos")
793793
})
794794

795+
test_that("scale updateable params is consistent with constructors", {
796+
797+
# Note: 'trans' is deprecated in favour of 'transform'
798+
constr_params <- function(fun) setdiff(fn_fmls_names(fun), "trans")
799+
800+
expect_setequal(
801+
ScaleContinuous$updatable_params,
802+
constr_params(continuous_scale)
803+
)
804+
805+
expect_setequal(
806+
ScaleDiscrete$updatable_params,
807+
constr_params(discrete_scale)
808+
)
809+
810+
expect_setequal(
811+
ScaleBinned$updatable_params,
812+
constr_params(binned_scale)
813+
)
814+
})
815+
795816
test_that("discrete scales can map to 2D structures", {
796817

797818
p <- ggplot(mtcars, aes(disp, mpg, colour = factor(cyl))) +

0 commit comments

Comments
 (0)