Skip to content

Commit d3252f8

Browse files
authored
test.data.table(testPattern=): preserve names(fn) (#7168)
Otherwise, failing a test results in a zero-length error message that itself errors out.
1 parent 8052346 commit d3252f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/test.data.table.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
197197
tryCatch(error = function(c) warningf("Attempt to subset to %d tests matching '%s' failed, running full suite.", length(keep_test_ids), testPattern), {
198198
new_script = file_lines[c(header_lines, keep_lines)]
199199
parse(text = new_script) # as noted above the static approach is not fool-proof (yet?), so force the script to at least parse before continuing.
200-
fn = tempfile()
200+
fn = setNames(tempfile(), names(fn))
201201
on.exit(unlink(fn), add=TRUE)
202202
catf("Running %d of %d tests matching '%s'\n", length(keep_test_ids), nrow(test_calls), testPattern)
203203
writeLines(new_script, fn)

0 commit comments

Comments
 (0)