r-hyperspec / r-hyperspec.github.io

Homepage for r-hyperspec ecosystem
https://r-hyperspec.github.io
0 stars 0 forks source link

language settings for testing #16

Open cbeleites opened 3 years ago

cbeleites commented 3 years ago

When checking for the correct warning() or error message, some of them are translated by R depending on language settings.

cbeleites commented 3 years ago

see https://stackoverflow.com/questions/47977951/how-to-ensure-english-error-messages-in-testthat-unit-tests

GegznaV commented 3 years ago

@cbeleites, could you, please, refer to a particular place where this issue arises?

Do suggestions in Stack Overflow comment (this is the one you sent) solve the issue?

e.g., this one:

expect_error_lang <- function(..., lang = "EN") {
    Sys.setenv("LANGUAGE" = lang)
    expect_error(...)
    Sys.unsetenv("LANGUAGE")
  }