@@ -8,38 +8,23 @@ test_that("expected_named verifies actual of names", {
88 expect_snapshot_failure(expect_named(c(a = 1 ), " b" ))
99})
1010
11- test_that(" expected_named optionally ignores case" , {
12- expect_success(expect_named(c(a = 1 ), " A" , ignore.case = TRUE ))
13- })
14-
15- test_that(" expected_named optionally ignores order" , {
16- expect_success(expect_named(
17- c(a = 1 , b = 2 ),
18- c(" b" , " a" ),
19- ignore.order = TRUE
20- ))
11+ test_that(" expected_named optionally ignores order and case" , {
12+ x <- c(a = 1 , b = 2 )
13+ expect_success(expect_named(x , c(" A" , " B" ), ignore.case = TRUE ))
14+ expect_success(expect_named(x , c(" b" , " a" ), ignore.order = TRUE ))
2115})
2216
2317test_that(" provide useful feedback on failure" , {
24- expect_snapshot_error(
25- expect_named(c(a = 1 ), c(" a" , " b" ), ignore.order = TRUE )
26- )
27- expect_snapshot_error(
28- expect_named(c(a = 1 , b = 1 ), c(" a" ), ignore.order = TRUE )
29- )
30- expect_snapshot_error(
31- expect_named(c(a = 1 ), c(" b" ), ignore.order = TRUE )
32- )
18+ x1 <- c(a = 1 )
19+ x2 <- c(a = 1 , b = 2 )
3320
34- expect_snapshot_error(
35- expect_named(c(a = 1 ), c(" a" , " b" ), ignore.order = FALSE )
36- )
37- expect_snapshot_error(
38- expect_named(c(a = 1 , b = 1 ), c(" a" ), ignore.order = FALSE )
39- )
40- expect_snapshot_error(
41- expect_named(c(a = 1 ), c(" b" ), ignore.order = FALSE )
42- )
21+ expect_snapshot_failure(expect_named(x1 , c(" a" , " b" ), ignore.order = TRUE ))
22+ expect_snapshot_failure(expect_named(x2 , " a" , ignore.order = TRUE ))
23+ expect_snapshot_failure(expect_named(x1 , " b" , ignore.order = TRUE ))
24+
25+ expect_snapshot_failure(expect_named(x1 , c(" a" , " b" ), ignore.order = FALSE ))
26+ expect_snapshot_failure(expect_named(x2 , " a" , ignore.order = FALSE ))
27+ expect_snapshot_failure(expect_named(x1 , c(" b" ), ignore.order = FALSE ))
4328})
4429
4530test_that(" expect_named validates its inputs" , {
0 commit comments