Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CRAN_Release.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ q("no")
R CMD check data.table_1.12.3.tar.gz
rm ~/.Renviron

# Test non-English does not break test.data.table() due to translation of messages; #3039, #630
LANGUAGE=de R
require(data.table)
test.data.table()

R
remove.packages("xml2") # we checked the URLs; don't need to do it again (many minutes)
require(data.table)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@

10. `externalVar=1:5; DT[, mean(externalVar), by=group]` could return incorrect results rather than a constant (`3` in this example) for each group, [#875](https://github.com/Rdatatable/data.table/issues/875). GForce optimization was being applied incorrectly to the `mean` without realizing `externalVar` was not a column.

11. `test.data.table()` now passes in non-English R sessions, [#630](https://github.com/Rdatatable/data.table/issues/630) [#3039](https://github.com/Rdatatable/data.table/issues/3039). Each test still checks that the number of warnings and/or errors produced is correct. However, a message is displayed suggesting to restart R with `LANGUAGE=en` in order to test that the text of the warning and/or error messages are as expected, too.

#### NOTES

1. `rbindlist`'s `use.names="check"` now emits its message for automatic column names (`"V[0-9]+"`) too, [#3484](https://github.com/Rdatatable/data.table/pull/3484). See news item 5 of v1.12.2 below.
Expand Down
14 changes: 13 additions & 1 deletion R/test.data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ test.data.table <- function(verbose=FALSE, pkg="pkg", silent=FALSE, with.other.p
cat("Running", fn, "\n")
env = new.env(parent=.GlobalEnv)
assign("testDir", function(x) file.path(fulldir, x), envir=env)

# are R's messages being translated to a foreign language? #3039, #630
txt = eval(parse(text="tryCatch(mean(not__exist__), error = function(e) e$message)"), envir=.GlobalEnv)
foreign = txt != "object 'not__exist__' not found"
if (foreign) {
# nocov start
cat("\n**** This R session's language is not English. Each test will still check that the correct number of errors and/or\n",
"**** warnings are produced. However, to test the text of each error/warning too, please restart R with LANGUAGE=en\n\n", sep="")
# nocov end
}
assign("foreign", foreign, envir=env)
assign("nfail", 0L, envir=env)
assign("ntest", 0L, envir=env)
assign("prevtest", -1, envir=env)
Expand Down Expand Up @@ -221,6 +232,7 @@ test <- function(num,x,y=TRUE,error=NULL,warning=NULL,output=NULL,message=NULL)
memtest = get("memtest", parent.frame())
inittime = get("inittime", parent.frame())
filename = get("filename", parent.frame())
foreign = get("foreign", parent.frame())
time = nTest = NULL # to avoid 'no visible binding' note
on.exit( {
now = proc.time()[3]
Expand Down Expand Up @@ -300,7 +312,7 @@ test <- function(num,x,y=TRUE,error=NULL,warning=NULL,output=NULL,message=NULL)
} else {
# the expected type occurred and, if more than 1 of that type, in the expected order
for (i in seq_along(expected)) {
if (!string_match(expected[i], observed[i])) {
if (!foreign && !string_match(expected[i], observed[i])) {
# nocov start
cat("Test",numStr,"didn't produce the correct",type,":\n")
cat("Expected:", expected[i], "\n")
Expand Down