Skip to content

Commit

Permalink
Make code easier to understnad
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Nov 5, 2024
1 parent 6328222 commit c819edc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/expect-setequal.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ expect_setequal <- function(object, expected) {
warn("expect_setequal() ignores names")
}

act_miss <- !act$val %in% exp$val
exp_miss <- !exp$val %in% act$val
act_miss <- setdiff(act$val, exp$val)
exp_miss <- setdiff(exp$val, act$val)

if (any(exp_miss) || any(act_miss)) {
if (length(exp_miss) || length(act_miss)) {
fail(paste0(
act$lab, " (`actual`) and ", exp$lab, " (`expected`) don't have the same values.\n",
if (any(act_miss))
paste0("* Only in `actual`: ", values(act$val[act_miss]), "\n"),
if (any(exp_miss))
paste0("* Only in `expected`: ", values(exp$val[exp_miss]), "\n")
if (length(act_miss))
paste0("* Only in `actual`: ", values(act_miss), "\n"),
if (length(exp_miss))
paste0("* Only in `expected`: ", values(exp_miss), "\n")
))
} else {
succeed()
Expand Down

0 comments on commit c819edc

Please sign in to comment.