85 | 85 |
}
|
86 | 86 |
}
|
87 | 87 |
|
|
88 |
func TestDeeperEquality(t *testing.T) {
|
|
89 |
type testStr string
|
|
90 |
slice1 := []interface{}{"A", 1, []byte("steak sauce")}
|
|
91 |
slice2 := []interface{}{"R", 2, 'd', int64(2)}
|
|
92 |
map1 := map[string]string{"clever": "crafty", "modest": "prim"}
|
|
93 |
map2 := map[string]string{"silk": "scarf", "wool": "sweater"}
|
|
94 |
str1 := "same"
|
|
95 |
str2 := testStr("same")
|
|
96 |
|
|
97 |
st.Expect(t, slice1, slice2)
|
|
98 |
st.Reject(t, slice1, slice1)
|
|
99 |
st.Expect(t, map1, map2)
|
|
100 |
st.Reject(t, map1, map1)
|
|
101 |
st.Expect(t, str1, str2)
|
|
102 |
st.Reject(t, str1, str1)
|
|
103 |
}
|
88 | 104 |
```
|
89 | 105 |
|
90 | 106 |
```console
|
91 | 107 |
--- FAIL: TestFailedExpectationMessages (0.00 seconds)
|
92 | |
st.go:31:
|
93 | |
readme_test.go:38: actual should == expected
|
94 | |
have (int): 2
|
95 | |
want (int): 1
|
96 | |
st.go:40:
|
97 | |
readme_test.go:39: actual should != expected
|
98 | |
have (string): same
|
99 | |
and (string): same
|
100 | |
st.go:31:
|
101 | |
readme_test.go:41: actual should == expected
|
102 | |
have (<nil>): <nil>
|
103 | |
want (*string): <nil>
|
|
108 |
readme_test.go:38: Tests purposely fail to demonstrate output
|
|
109 |
st.go:41:
|
|
110 |
readme_test.go:39: actual should == expected
|
|
111 |
have: (int) 2
|
|
112 |
want: (int) 1
|
|
113 |
st.go:50:
|
|
114 |
readme_test.go:40: actual should != expected
|
|
115 |
have: (string) same
|
|
116 |
and : (string) same
|
|
117 |
st.go:41:
|
|
118 |
readme_test.go:42: actual should == expected
|
|
119 |
have: (<nil>) <nil>
|
|
120 |
want: (*string) <nil>
|
104 | 121 |
--- FAIL: TestFailedAssertMessage (0.00 seconds)
|
105 | |
st.go:49:
|
106 | |
readme_test.go:48: actual should == expected
|
107 | |
have (readme.chicken): {}
|
108 | |
want (readme.egg): {}
|
|
122 |
st.go:59:
|
|
123 |
readme_test.go:49: actual should == expected
|
|
124 |
have: (readme.chicken) {}
|
|
125 |
want: (readme.egg) {}
|
109 | 126 |
--- FAIL: TestFailedRefuteMessage (0.00 seconds)
|
110 | |
st.go:40:
|
111 | |
readme_test.go:53: actual should != expected
|
112 | |
have (int): 42
|
113 | |
and (int): 42
|
|
127 |
st.go:50:
|
|
128 |
readme_test.go:54: actual should != expected
|
|
129 |
have: (int) 42
|
|
130 |
and : (int) 42
|
114 | 131 |
--- FAIL: TestFailedTableMessages (0.00 seconds)
|
115 | |
st.go:31:
|
116 | |
readme_test.go:63: actual should == expected
|
117 | |
0. have (int): 1
|
118 | |
want (int): 0
|
119 | |
st.go:31:
|
120 | |
readme_test.go:63: actual should == expected
|
121 | |
2. have (int): 1
|
122 | |
want (int): 2
|
123 | |
st.go:49:
|
124 | |
readme_test.go:67: actual should == expected
|
125 | |
have (int): 1
|
126 | |
want (int): 0
|
|
132 |
st.go:41:
|
|
133 |
readme_test.go:64: actual should == expected
|
|
134 |
0. have: (int) 1
|
|
135 |
want: (int) 0
|
|
136 |
st.go:41:
|
|
137 |
readme_test.go:64: actual should == expected
|
|
138 |
2. have: (int) 1
|
|
139 |
want: (int) 2
|
|
140 |
st.go:59:
|
|
141 |
readme_test.go:68: actual should == expected
|
|
142 |
have: (int) 1
|
|
143 |
want: (int) 0
|
|
144 |
--- FAIL: TestDeeperEquality (0.00 seconds)
|
|
145 |
st.go:41:
|
|
146 |
readme_test.go:83: actual should == expected
|
|
147 |
have: ([]interface {}) [R 2 100 2]
|
|
148 |
want: ([]interface {}) [A 1 [115 116 101 97 107 32 115 97 117 99 101]]
|
|
149 |
st.go:50:
|
|
150 |
readme_test.go:84: actual should != expected
|
|
151 |
have: ([]interface {}) [A 1 [115 116 101 97 107 32 115 97 117 99 101]]
|
|
152 |
and : ([]interface {}) [A 1 [115 116 101 97 107 32 115 97 117 99 101]]
|
|
153 |
st.go:41:
|
|
154 |
readme_test.go:85: actual should == expected
|
|
155 |
have: (map[string]string) map[silk:scarf wool:sweater]
|
|
156 |
want: (map[string]string) map[clever:crafty modest:prim]
|
|
157 |
st.go:50:
|
|
158 |
readme_test.go:86: actual should != expected
|
|
159 |
have: (map[string]string) map[clever:crafty modest:prim]
|
|
160 |
and : (map[string]string) map[clever:crafty modest:prim]
|
|
161 |
st.go:41:
|
|
162 |
readme_test.go:87: actual should == expected
|
|
163 |
have: (readme.testStr) same
|
|
164 |
want: (string) same
|
|
165 |
st.go:50:
|
|
166 |
readme_test.go:88: actual should != expected
|
|
167 |
have: (string) same
|
|
168 |
and : (string) same
|
127 | 169 |
FAIL
|
128 | 170 |
exit status 1
|
129 | |
FAIL github.com/nbio/st/readme 0.010s
|
|
171 |
FAIL github.com/nbio/st/readme 0.012s
|
130 | 172 |
```
|
131 | 173 |
|
132 | 174 |
See [`package st`](https://godoc.org/github.com/nbio/st) documentation for more detail.
|