@@ -93,6 +93,7 @@ func (responseWriterErr) WriteHeader(statusCode int) {
9393
9494func TestContext (t * testing.T ) {
9595 e := New ()
96+ * e .maxParam = 1
9697 req := httptest .NewRequest (http .MethodPost , "/" , strings .NewReader (userJSON ))
9798 rec := httptest .NewRecorder ()
9899 c := e .NewContext (req , rec ).(* context )
@@ -471,6 +472,7 @@ func TestContextPath(t *testing.T) {
471472
472473func TestContextPathParam (t * testing.T ) {
473474 e := New ()
475+ * e .maxParam = 2
474476 req := httptest .NewRequest (http .MethodGet , "/" , nil )
475477 c := e .NewContext (req , nil )
476478
@@ -487,6 +489,26 @@ func TestContextPathParam(t *testing.T) {
487489 testify .Equal (t , "" , c .Param ("undefined" ))
488490}
489491
492+ func TestContextGetAndSetParam (t * testing.T ) {
493+ e := New ()
494+ * e .maxParam = 2
495+ req := httptest .NewRequest (http .MethodGet , "/:foo" , nil )
496+ c := e .NewContext (req , nil )
497+ c .SetParamNames ("foo" )
498+
499+ // round-trip param values with modification
500+ paramVals := c .ParamValues ()
501+ testify .EqualValues (t , []string {"" }, c .ParamValues ())
502+ paramVals [0 ] = "bar"
503+ c .SetParamValues (paramVals ... )
504+ testify .EqualValues (t , []string {"bar" }, c .ParamValues ())
505+
506+ // shouldn't explode during Reset() afterwards!
507+ testify .NotPanics (t , func () {
508+ c .Reset (nil , nil )
509+ })
510+ }
511+
490512func TestContextFormValue (t * testing.T ) {
491513 f := make (url.Values )
492514 f .Set ("name" , "Jon Snow" )
0 commit comments