| 
 | 1 | +# warns if both inputs are named  | 
 | 2 | + | 
 | 3 | +    Code  | 
 | 4 | +      expect_setequal(c(a = 1), c(b = 1))  | 
 | 5 | +    Condition  | 
 | 6 | +      Warning:  | 
 | 7 | +      expect_setequal() ignores names  | 
 | 8 | + | 
 | 9 | +# checks inputs  | 
 | 10 | + | 
 | 11 | +    Code  | 
 | 12 | +      expect_setequal(sum, 1)  | 
 | 13 | +    Condition  | 
 | 14 | +      Error in `expect_setequal()`:  | 
 | 15 | +      ! `object` must be a vector, not a primitive function.  | 
 | 16 | +    Code  | 
 | 17 | +      expect_setequal(1, sum)  | 
 | 18 | +    Condition  | 
 | 19 | +      Error in `expect_setequal()`:  | 
 | 20 | +      ! `expected` must be a vector, not a primitive function.  | 
 | 21 | +    Code  | 
 | 22 | +      expect_setequal(!!fun, 1)  | 
 | 23 | +    Condition  | 
 | 24 | +      Error in `expect_setequal()`:  | 
 | 25 | +      ! `object` must be a vector, not a primitive function.  | 
 | 26 | +    Code  | 
 | 27 | +      expect_setequal(1, !!fun)  | 
 | 28 | +    Condition  | 
 | 29 | +      Error in `expect_setequal()`:  | 
 | 30 | +      ! `expected` must be a vector, not a primitive function.  | 
 | 31 | + | 
 | 32 | +# useful message on failure  | 
 | 33 | + | 
 | 34 | +    Code  | 
 | 35 | +      expect_setequal("actual", "expected")  | 
 | 36 | +    Condition  | 
 | 37 | +      Error:  | 
 | 38 | +      ! Expected "actual" to have the same values as "expected".  | 
 | 39 | +      Actual: "actual"  | 
 | 40 | +      Expected: "expected"  | 
 | 41 | +      Needs: "actual"  | 
 | 42 | +      Absent: "expected"  | 
 | 43 | + | 
 | 44 | +---  | 
 | 45 | + | 
 | 46 | +    Code  | 
 | 47 | +      expect_setequal(x, y)  | 
 | 48 | +    Condition  | 
 | 49 | +      Error:  | 
 | 50 | +      ! Expected `x` to have the same values as `y`.  | 
 | 51 | +      Actual: 1, 2  | 
 | 52 | +      Expected: 2  | 
 | 53 | +      Needs: 1  | 
 | 54 | + | 
 | 55 | +---  | 
 | 56 | + | 
 | 57 | +    Code  | 
 | 58 | +      expect_setequal(x, y)  | 
 | 59 | +    Condition  | 
 | 60 | +      Error:  | 
 | 61 | +      ! Expected `x` to have the same values as `y`.  | 
 | 62 | +      Actual: 2  | 
 | 63 | +      Expected: 2, 3  | 
 | 64 | +      Absent: 3  | 
 | 65 | + | 
 | 66 | +---  | 
 | 67 | + | 
 | 68 | +    Code  | 
 | 69 | +      expect_setequal(x, y)  | 
 | 70 | +    Condition  | 
 | 71 | +      Error:  | 
 | 72 | +      ! Expected `x` to have the same values as `y`.  | 
 | 73 | +      Actual: 1, 2  | 
 | 74 | +      Expected: 2, 3  | 
 | 75 | +      Needs: 1  | 
 | 76 | +      Absent: 3  | 
 | 77 | + | 
 | 78 | +---  | 
 | 79 | + | 
 | 80 | +    Code  | 
 | 81 | +      expect_setequal(x, y)  | 
 | 82 | +    Condition  | 
 | 83 | +      Error:  | 
 | 84 | +      ! Expected `x` to have the same values as `y`.  | 
 | 85 | +      Actual: "a", "a"  | 
 | 86 | +      Expected: "b", "b", "b"  | 
 | 87 | +      Needs: "a"  | 
 | 88 | +      Absent: "b"  | 
 | 89 | + | 
 | 90 | +---  | 
 | 91 | + | 
 | 92 | +    Code  | 
 | 93 | +      expect_setequal(x, c("a", "b", "c", "d"))  | 
 | 94 | +    Condition  | 
 | 95 | +      Error:  | 
 | 96 | +      ! Expected `x` to have the same values as `c("a", "b", "c", "d")`.  | 
 | 97 | +      Actual: "a", "b", "c"  | 
 | 98 | +      Expected: "a", "b", "c", "d"  | 
 | 99 | +      Absent: "d"  | 
 | 100 | + | 
 | 101 | +# truncates long vectors  | 
 | 102 | + | 
 | 103 | +    Code  | 
 | 104 | +      expect_setequal(x, y)  | 
 | 105 | +    Condition  | 
 | 106 | +      Error:  | 
 | 107 | +      ! Expected `x` to have the same values as `y`.  | 
 | 108 | +      Actual: 1, 2  | 
 | 109 | +      Expected: 1, 2, 3, 4, 5, 6, 7, 8, 9, ...  | 
 | 110 | +      Absent: 3, 4, 5, 6, 7, 8, 9, 10, 11, ...  | 
 | 111 | + | 
 | 112 | +# expect_contains() gives useful message on failure  | 
 | 113 | + | 
 | 114 | +    Code  | 
 | 115 | +      expect_contains(x1, x2)  | 
 | 116 | +    Condition  | 
 | 117 | +      Error:  | 
 | 118 | +      ! Expected `x1` to contain all values in `x2`.  | 
 | 119 | +      Actual: "a", "b", "c"  | 
 | 120 | +      Expected: "c", "d"  | 
 | 121 | +      Missing: "d"  | 
 | 122 | + | 
 | 123 | +---  | 
 | 124 | + | 
 | 125 | +    Code  | 
 | 126 | +      expect_contains(x1, x3)  | 
 | 127 | +    Condition  | 
 | 128 | +      Error:  | 
 | 129 | +      ! Expected `x1` to contain all values in `x3`.  | 
 | 130 | +      Actual: "a", "b", "c"  | 
 | 131 | +      Expected: "d", "e"  | 
 | 132 | +      Missing: "d", "e"  | 
 | 133 | + | 
 | 134 | +# expect_in() gives useful message on failure  | 
 | 135 | + | 
 | 136 | +    Code  | 
 | 137 | +      expect_in(x1, x2)  | 
 | 138 | +    Condition  | 
 | 139 | +      Error:  | 
 | 140 | +      ! Expected `x1` to only contain values from `x2`.  | 
 | 141 | +      Actual: "a", "b"  | 
 | 142 | +      Expected: "b", "c"  | 
 | 143 | +      Invalid: "a"  | 
 | 144 | + | 
 | 145 | +---  | 
 | 146 | + | 
 | 147 | +    Code  | 
 | 148 | +      expect_in(x1, x3)  | 
 | 149 | +    Condition  | 
 | 150 | +      Error:  | 
 | 151 | +      ! Expected `x1` to only contain values from `x3`.  | 
 | 152 | +      Actual: "a", "b"  | 
 | 153 | +      Expected: "d", "e"  | 
 | 154 | +      Invalid: "a", "b"  | 
 | 155 | + | 
0 commit comments