Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# lobstr (development version)

* `ref()` lists all contents of environments even those with names beginning
with `.` (@krlmlr, #53).

* `obj_size()` and `sxp()` now support non-nil terminated pairlists.

* `obj_sizes()` no longer returns NA for objects larger than 2^31 bytes (#45)
Expand Down
2 changes: 1 addition & 1 deletion R/ref.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ref_tree <- function(x, character = FALSE, seen = child_env(emptyenv()), layout
if (is.list(x)) {
subtrees <- lapply(x, ref_tree, layout = layout, seen = seen, character = character)
} else if (is.environment(x)) {
subtrees <- lapply(as.list(x), ref_tree, layout = layout, seen = seen, character = character)
subtrees <- lapply(as.list(x, all.names = TRUE), ref_tree, layout = layout, seen = seen, character = character)
} else if (is.character(x)) {
subtrees <- ref_tree_chr(x, layout = layout, seen = seen)
}
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/_snaps/ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
├─b = [2:0x002]
└─c = [1:0x001]

# environment shows objects beginning with .

Code
e <- env(. = 1:10)
ref(e)
Output
█ [1:0x001] <env>
└─. = [2:0x002] <int>

# can display ref to global string pool on request

Code
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-ref.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ test_that("basic environment display", {
})
})

test_that("environment shows objects beginning with .", {
skip_on_os("windows")

test_addr_reset()
expect_snapshot({
e <- env(. = 1:10)
ref(e)
})
})


test_that("can display ref to global string pool on request", {
skip_on_os("windows")

Expand Down