@@ -77,6 +77,25 @@ func TestContextReset(t *testing.T) {
77
77
assert .Equal (t , c .Writer .(* responseWriter ), & c .writermem )
78
78
}
79
79
80
+ func TestContextHandlers (t * testing.T ) {
81
+ c , _ , _ := createTestContext ()
82
+ assert .Nil (t , c .handlers )
83
+ assert .Nil (t , c .handlers .Last ())
84
+
85
+ c .handlers = HandlersChain {}
86
+ assert .NotNil (t , c .handlers )
87
+ assert .Nil (t , c .handlers .Last ())
88
+
89
+ f := func (c * Context ) {}
90
+ g := func (c * Context ) {}
91
+
92
+ c .handlers = HandlersChain {f }
93
+ compareFunc (t , f , c .handlers .Last ())
94
+
95
+ c .handlers = HandlersChain {f , g }
96
+ compareFunc (t , g , c .handlers .Last ())
97
+ }
98
+
80
99
// TestContextSetGet tests that a parameter is set correctly on the
81
100
// current context and can be retrieved using Get.
82
101
func TestContextSetGet (t * testing.T ) {
@@ -190,13 +209,13 @@ func TestContextQueryAndPostForm(t *testing.T) {
190
209
191
210
var obj struct {
192
211
Foo string `form:"foo"`
193
- Id string `form:"id"`
212
+ ID string `form:"id"`
194
213
Page string `form:"page"`
195
214
Both string `form:"both"`
196
215
}
197
216
assert .NoError (t , c .Bind (& obj ))
198
217
assert .Equal (t , obj .Foo , "bar" )
199
- assert .Equal (t , obj .Id , "main" )
218
+ assert .Equal (t , obj .ID , "main" )
200
219
assert .Equal (t , obj .Page , "11" )
201
220
assert .Equal (t , obj .Both , "POST" )
202
221
}
0 commit comments