From 0459f08139840ea3ae6c6f9d484fd115e15a58c0 Mon Sep 17 00:00:00 2001 From: aitap Date: Mon, 10 Feb 2025 17:53:53 +0000 Subject: [PATCH 1/2] `test.data.table()`: fix arguments to catf() (#6811) * test.data.table: fix arguments to catf() This ensures that interactive test.data.table() prints the test numbers while running (and avoids an error due to options(warn=2) in the middle of tests.Rraw). Also, # nocov the entire if (showProgress) branch. * nit: placement of #nocov --------- Co-authored-by: Michael Chirico --- R/test.data.table.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/test.data.table.R b/R/test.data.table.R index 1f3b8ebfe..36ddb36dc 100644 --- a/R/test.data.table.R +++ b/R/test.data.table.R @@ -384,8 +384,11 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no assign("lasttime", proc.time()[3L], parent.frame(), inherits=TRUE) # after gc() to exclude gc() time from next test when memtest }, add=TRUE ) if (showProgress) { + # nocov start cat("\r") # notranslate: \r can't be in gettextf msg - catf("Running test id", numStr, " ") # nocov. + catf("Running test id %s", numStr) + cat(" ") # notranslate + # nocov end } # See PR #4090 for comments about change here in Dec 2019. # If a segfault error occurs in future and we'd like to know after which test, then arrange for the From 00d53f4904f5576ca16b4fef4e5818edc9877f30 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 10 Feb 2025 09:56:53 -0800 Subject: [PATCH 2/2] Shorthand lambda unavailable on old R (#6812) --- inst/tests/tests.Rraw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index 0649b15ae..85b78cfa2 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -7888,7 +7888,7 @@ test(1551.5, fread(str), rhs = setDT(read.table(testDir("issue_1095_fread.txt.bz2"), sep=",", comment.char="", stringsAsFactors=FALSE, quote="", strip.white=TRUE)) if (test_R.utils) { test(1551.61, fread(testDir("issue_1095_fread.txt.bz2"), logical01=FALSE), rhs, warning=w) - rhs[, names(.SD) := lapply(.SD, \(x) x == "Y"), .SDcols = c("V16", "V17", "V45")] + rhs[, names(.SD) := lapply(.SD, function(x) x == "Y"), .SDcols = c("V16", "V17", "V45")] test(1551.62, fread(testDir("issue_1095_fread.txt.bz2"), logical01=FALSE, logicalYN=TRUE), rhs, warning=w) }