Skip to content

Commit

Permalink
Don't skip when LC_ALL is unset after all
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- committed Jan 9, 2024
1 parent 21069bc commit e1fa020
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
}

0 comments on commit e1fa020

Please sign in to comment.