diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index 8dec384..b8f6cdc 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -40,9 +40,13 @@ skip_if_cannot_knit <- function() { # Used to skip tests that will fail when locale is set to C, for # instance `with_language()` tests. These tests should only be run -# when using a locale like `en_US`. The check is cautious and simple: -# If unset we assume the default might be C or maybe `LANG` is set to C. +# when using a locale like `en_US`. skip_if_c_locale <- function() { lc_all <- Sys.getenv("LC_ALL", "") - skip_if(lc_all %in% c("", "C", "C.UTF-8")) + skip_if(lc_all %in% c("C", "C.UTF-8")) + + if (lc_all == "") { + lang <- Sys.getenv("LANG", "") + skip_if(lang %in% c("C", "C.UTF-8")) + } }