Skip to content

Commit

Permalink
Fix tests on R-devel.
Browse files Browse the repository at this point in the history
As of yesterday, the development version of R preserves names in its
implementation of `setdiff` (and other set-like operations). This has
changed the behaviour of `root_list_unknown_packets` to also preserves
names, which broke some tests that were a little too strict about it.

```
$ docker run -it rocker/r-ver:devel R -s -e 'dput(setdiff(c(a=1), NULL))'
c(a = 1)
$ docker run -it rocker/r-ver:4.4 R -s -e 'dput(setdiff(c(a=1), NULL))'
1
```

See r-devel/r-svn@982288a
for the offending upstream change.
  • Loading branch information
plietar committed Sep 2, 2024
1 parent 3e9d400 commit fcb9e4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/test-outpack-root.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ test_that("Can work out what packets are missing", {
for (name in c("a", "b")) {
root[[name]] <- create_temporary_root()
}
ids <- create_random_packet_chain(root$a, 3)
ids <- unname(create_random_packet_chain(root$a, 3))
orderly_location_add("a", "path", list(path = root$a$path), root = root$b)
orderly_location_pull_metadata(root = root$b)

Expand All @@ -118,7 +118,7 @@ test_that("Can work out what packets are missing", {
expect_equal(root_list_unknown_packets(rev(ids_fake), root$a),
rev(ids_fake))

ids_all <- sample(c(unname(ids), ids_fake))
ids_all <- sample(c(ids, ids_fake))
expect_equal(root_list_unknown_packets(ids_all, root$a),
setdiff(ids_all, ids))
expect_equal(root_list_unknown_packets(ids_all, root$b),
Expand Down

0 comments on commit fcb9e4b

Please sign in to comment.