From d680dcc2b790331fc865a6b4cf05ec0a83474393 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Sun, 12 Jul 2020 10:50:21 +0900 Subject: [PATCH 1/3] Regenerate document --- man/scale_viridis.Rd | 1 + 1 file changed, 1 insertion(+) diff --git a/man/scale_viridis.Rd b/man/scale_viridis.Rd index c6bc808c5e..03dd0dbb5f 100644 --- a/man/scale_viridis.Rd +++ b/man/scale_viridis.Rd @@ -12,6 +12,7 @@ \alias{scale_fill_ordinal} \alias{scale_color_viridis_d} \alias{scale_color_viridis_c} +\alias{scale_color_viridis_b} \title{Viridis colour scales from viridisLite} \usage{ scale_colour_viridis_d( From b0a4422cb172cf23a9e3f96171ff97c123ff925c Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Sun, 12 Jul 2020 10:51:02 +0900 Subject: [PATCH 2/3] Add a test to confirm no missing scale_color_* --- tests/testthat/test-scales.r | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/testthat/test-scales.r b/tests/testthat/test-scales.r index 2620a349de..a6c6b1fa22 100644 --- a/tests/testthat/test-scales.r +++ b/tests/testthat/test-scales.r @@ -370,3 +370,15 @@ test_that("scale_apply preserves class and attributes", { expect_false(inherits(out, "foobar")) expect_null(attributes(out)) }) + +test_that("All scale_colour_*() have their American versions", { + # In testthat, the package env contains non-exported functions as well so we + # need to parse NAMESPACE file by ourselves + exports <- readLines(system.file("NAMESPACE", package = "ggplot2")) + colour_scale_exports <- grep("scale_.*colour", exports, value = TRUE) + color_scale_exports <- grep("scale_.*color", exports, value = TRUE) + expect_equal( + colour_scale_exports, + sub("color", "colour", color_scale_exports) + ) +}) From 67fe9224aa1fe8f1c898ab707d305b082e83d324 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Mon, 13 Jul 2020 09:45:39 +0900 Subject: [PATCH 3/3] Fix regex pattern --- tests/testthat/test-scales.r | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-scales.r b/tests/testthat/test-scales.r index a6c6b1fa22..e1e5be83dd 100644 --- a/tests/testthat/test-scales.r +++ b/tests/testthat/test-scales.r @@ -375,8 +375,8 @@ test_that("All scale_colour_*() have their American versions", { # In testthat, the package env contains non-exported functions as well so we # need to parse NAMESPACE file by ourselves exports <- readLines(system.file("NAMESPACE", package = "ggplot2")) - colour_scale_exports <- grep("scale_.*colour", exports, value = TRUE) - color_scale_exports <- grep("scale_.*color", exports, value = TRUE) + colour_scale_exports <- grep("export\\(scale_colour_.*\\)", exports, value = TRUE) + color_scale_exports <- grep("export\\(scale_color_.*\\)", exports, value = TRUE) expect_equal( colour_scale_exports, sub("color", "colour", color_scale_exports)