Skip to content

Commit 1e6ad03

Browse files
committed
use mget for all vector params
1 parent 996b28c commit 1e6ad03

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

R/test.data.table.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,19 +367,19 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no
367367
cl = match.call()
368368
cl$optimization = NULL # Remove optimization levels from the recursive call
369369

370-
vector_params = c("error", "warning", "message", "output", "notOutput", "ignore.warning")
371370
# Check if y was explicitly provided (not just the default)
372371
y_provided = !missing(y)
373-
compare = !y_provided && length(optimization)>1L && !any(vapply_1b(vector_params, function(p) length(get(p, envir=environment())) > 0L))
372+
vector_params = mget(c("error", "warning", "message", "output", "notOutput", "ignore.warning"), environment())
373+
compare = !y_provided && length(optimization)>1L && !any(lengths(vector_params))
374374

375375
for (i in seq_along(optimization)) {
376376
cl$num = num + (i - 1L) * 1e-6
377377
opt_level = list(datatable.optimize = optimization[i])
378378
cl$options = if (!is.null(options)) c(as.list(options), opt_level) else opt_level
379-
for (p in vector_params) {
380-
val = get(p, envir=environment())
379+
for (param in names(vector_params)) {
380+
val = vector_params[[param]]
381381
if (length(val) > 0L) {
382-
cl[[p]] = val[((i - 1L) %% length(val)) + 1L] # cycle through values if fewer than optimization levels
382+
cl[[param]] = val[((i - 1L) %% length(val)) + 1L] # cycle through values if fewer than optimization levels
383383
}
384384
}
385385

0 commit comments

Comments
 (0)