Closed
Description
As part of testthat 3e migration for lintr (r-lib/lintr#910), I'm trying to replace this expect_equal()
test comparing two environments whose content is identical:
With <3e, it dispatches to all.equal()
and voila.
With the stricter tests in waldo::compare()
, however, it's not so simple.
I was unable in a brief search to determine what one should do to compare environments themselves:
- there's no
compare_proxy.environment
- ?waldo::compare only mentions environments as regards
ignore_formula_env
andignore_function_env
(not really relevant here) expect_equal(e1, e2, ignore_attr=TRUE)
doesn't work, which seems to partially contradict ?waldo::compare ("For backward compatibility with all.equal(), you can also use TRUE..." -- which suggests we will get equivalent behavior to the oldexpect_equal()
by settingignore_attr=TRUE
)- no mention of environments on the landing page: https://waldo.r-lib.org/
- no vignettes
So I'm left wondering what's the recommended approach here.
The simplest fix is expect_identical(as.list(e1), as.list(e2))
, but it does feel a bit hacky.
Metadata
Metadata
Assignees
Labels
No labels