Skip to content

Commit 6047fa3

Browse files
author
Toby Dylan Hocking
committed
Merge branch 'issue#4177' of https://github.com/rdatatable/data.table into issue#4177
2 parents e54bd71 + ec25903 commit 6047fa3

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

.ci/atime/tests.R

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,37 @@ test.list <- atime::atime_test_list(
289289
# Test case adapted from https://github.com/Rdatatable/data.table/issues/4177 which is where the issue was reported.
290290
# Fixed in https://github.com/Rdatatable/data.table/pull/7236
291291
"fwrite select parameter improved in #4177" = atime::atime_test(
292+
# N row, 5 column
292293
setup = {
293-
set.seed(1)
294-
DT = data.table(a = rnorm(N), b = rnorm(N), c = rnorm(N), d = rnorm(N), e = rnorm(N))
294+
set.seed(1L)
295+
DT = data.table(a=rnorm(N), b=rnorm(N), c=rnorm(N), d=rnorm(N), e=rnorm(N))
296+
temp_file = tempfile()
297+
},
298+
expr = {
299+
has_select = "select" %chin% names(formals(data.table::fwrite))
300+
if (has_select) {
301+
data.table::fwrite(DT, temp_file, select = c("a","b","c"))
302+
} else {
303+
data.table::fwrite(DT[, c("a","b","c"), with = FALSE], temp_file)
304+
}
305+
},
306+
Slow = "66cb6d2393cef30083b444346a7600a079207806", # Parent of the first commit in the PR (https://github.com/Rdatatable/data.table/commit/66cb6d2393cef30083b444346a7600a079207806)
307+
Fast = "1887699fe965b5aa1fb8cb16b5507b7a5cbf5c85" # Commit in the PR (https://github.com/Rdatatable/data.table/pull/4177/commits) that adds select parameter
308+
# 1 row, N columns
309+
setup = {
310+
DT = data.table(t(1:N))
295311
temp_file = tempfile()
312+
},
313+
expr = {
296314
has_select = "select" %chin% names(formals(data.table::fwrite))
315+
if (has_select) {
316+
data.table::fwrite(DT, temp_file, select = 1L)
317+
} else {
318+
data.table::fwrite(DT[, 1L, with = FALSE], temp_file)
319+
}
297320
},
298-
expr = if (has_select)
299-
data.table::fwrite(DT, temp_file, select=c("a","b","c")),
300-
Slow = "66cb6d2393cef30083b444346a7600a079207806", # Parent of the first commit in the PR (https://github.com/Rdatatable/data.table/commit/66cb6d2393cef30083b444346a7600a079207806)
301-
Fast = "1887699fe965b5aa1fb8cb16b5507b7a5cbf5c85"), # Commit in the PR (https://github.com/Rdatatable/data.table/pull/4177/commits) that adds select parameter
321+
Slow = "66cb6d2393cef30083b444346a7600a079207806", # Parent of the first commit in the PR (https://github.com/Rdatatable/data.table/commit/66cb6d2393cef30083b444346a7600a079207806)
322+
Fast = "1887699fe965b5aa1fb8cb16b5507b7a5cbf5c85" # Commit in the PR (https://github.com/Rdatatable/data.table/pull/4177/commits) that adds select parameter
302323

303324
tests=extra.test.list)
304325
# nolint end: undesirable_operator_linter.

0 commit comments

Comments
 (0)