@@ -12,6 +12,16 @@ import (
12
12
"github.com/labstack/echo/v4"
13
13
)
14
14
15
+ // assertEqual compares two values and logs an error if they are not equal.
16
+ func assertEqual [T any ](t * testing.T , expected , actual T , message ... interface {}) bool {
17
+ t .Helper ()
18
+ equal , msg := testutil .DeepEqual (expected , actual , message ... )
19
+ if ! equal {
20
+ t .Errorf (msg )
21
+ }
22
+ return equal
23
+ }
24
+
15
25
func ExampleWithTenant () {
16
26
e := echo .New ()
17
27
@@ -133,8 +143,8 @@ func TestWithTenant(t *testing.T) {
133
143
134
144
if tt .wantErr {
135
145
he := handler (c ).(* echo.HTTPError )
136
- testutil . AssertEqual (t , http .StatusInternalServerError , he .Code )
137
- testutil . AssertEqual (t , "forced error" , he .Message )
146
+ assertEqual (t , http .StatusInternalServerError , he .Code )
147
+ assertEqual (t , "forced error" , he .Message )
138
148
return
139
149
}
140
150
@@ -144,10 +154,8 @@ func TestWithTenant(t *testing.T) {
144
154
return
145
155
}
146
156
147
- // testutil.AssertEqual(t, http.StatusOK, rec.Code)
148
- testutil .AssertEqual (t , http .StatusOK , rec .Code )
149
- // testutil.AssertEqual(t, tt.want, rec.Body.String())
150
- testutil .AssertEqual (t , tt .want , rec .Body .String ())
157
+ assertEqual (t , http .StatusOK , rec .Code )
158
+ assertEqual (t , tt .want , rec .Body .String ())
151
159
})
152
160
}
153
161
}
0 commit comments