File tree Expand file tree Collapse file tree 2 files changed +6
-23
lines changed Expand file tree Collapse file tree 2 files changed +6
-23
lines changed Original file line number Diff line number Diff line change @@ -45,28 +45,11 @@ expect_named <- function(
4545 exp <- quasi_label(enquo(expected ), arg = " expected" )
4646
4747 exp $ val <- normalise_names(exp $ val , ignore.order , ignore.case )
48- act $ names <- normalise_names(act $ names , ignore.order , ignore.case )
48+ act_names <- normalise_names(act $ names , ignore.order , ignore.case )
4949
5050 if (ignore.order ) {
51- act_miss <- unique(act $ names [! act $ names %in% exp $ val ])
52- exp_miss <- unique(exp $ val [! exp $ val %in% act $ names ])
53-
54- if (length(exp_miss ) != 0 || length(act_miss ) != 0 ) {
55- msg <- paste0(
56- " Names of " ,
57- act $ lab ,
58- " (`actual`) and " ,
59- exp $ lab ,
60- " (`expected`) don't have the same values.\n " ,
61- if (length(act_miss )) {
62- paste0(" * Only in `actual`: " , values(act_miss ), " \n " )
63- },
64- if (length(exp_miss )) {
65- paste0(" * Only in `expected`: " , values(exp_miss ), " \n " )
66- }
67- )
68- return (fail(msg ))
69- }
51+ act <- labelled_value(act_names , act $ lab )
52+ return (expect_setequal_(act , exp ))
7053 } else {
7154 if (! identical(act $ names , exp $ val )) {
7255 msg <- sprintf(
Original file line number Diff line number Diff line change 11# provide useful feedback on failure
22
3- Names of c(a = 1) (`actual`) and c("a", "b") (`expected`) don't have the same values.
3+ c(a = 1) (`actual`) and c("a", "b") (`expected`) don't have the same values.
44 * Only in `expected`: "b"
55
66
77---
88
9- Names of c(a = 1, b = 1) (`actual`) and c("a") (`expected`) don't have the same values.
9+ c(a = 1, b = 1) (`actual`) and c("a") (`expected`) don't have the same values.
1010 * Only in `actual`: "b"
1111
1212
1313---
1414
15- Names of c(a = 1) (`actual`) and c("b") (`expected`) don't have the same values.
15+ c(a = 1) (`actual`) and c("b") (`expected`) don't have the same values.
1616 * Only in `actual`: "a"
1717 * Only in `expected`: "b"
1818
You can’t perform that action at this time.
0 commit comments