Skip to content

Commit a0c2abe

Browse files
committed
feat(2606): added tests for list_search on tables changes
1 parent 11b8d04 commit a0c2abe

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
1. `nafill()`, `setnafill()` extended to work on logical vectors (part of [#3992](https://github.com/Rdatatable/data.table/issues/3992)). Thanks @jangorecki for the request and @MichaelChirico for the PR.
1818

19+
2. `tables()` can now optionally report `data.table` objects stored one level deep inside list objects when `list_search=TRUE`, with `list_len_threshold` to avoid scanning extremely long lists, [#2606](https://github.com/Rdatatable/data.table/issues/2606).
20+
1921
### Notes
2022

2123
1. {data.table} now depends on R 3.5.0 (2018).

inst/tests/tests.Rraw

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21978,3 +21978,19 @@ local({
2197821978
test(2357.1, fread(f), DT)
2197921979
test(2357.2, fread(paste0("file://", f)), DT)
2198021980
})
21981+
21982+
#2606 tables() list_search finds nested data.tables in lists
21983+
xenv2 = new.env()
21984+
xenv2$L = list(
21985+
data.table(a = 1L),
21986+
data.table(a = 1:2)
21987+
)
21988+
test(2358.1,
21989+
tables(env = xenv2, silent = TRUE, list_search = TRUE)[, .(NAME, NROW, NCOL)],
21990+
data.table(NAME = c("L[[1]]", "L[[2]]"), NROW = c(1L, 2L), NCOL = c(1L, 1L))
21991+
)
21992+
test(2358.2,
21993+
nrow(tables(env = xenv2, silent = TRUE, list_search = TRUE, list_len_threshold = 1L)),
21994+
0L
21995+
)
21996+
rm(xenv2)

0 commit comments

Comments
 (0)