mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 04:33:40 +08:00
Added tests for GetDefault
This commit is contained in:
parent
e600055457
commit
c78c27d8c2
@ -54,6 +54,17 @@ func TestContextSetGet(t *testing.T) {
|
||||
if v != "bar" {
|
||||
t.Errorf("Value should be bar, was %s", v)
|
||||
}
|
||||
|
||||
// GetDefault
|
||||
v = c.GetDefault("foo", "baz")
|
||||
if v != "bar" {
|
||||
t.Errorf("Value should be bar, was %s", v)
|
||||
}
|
||||
|
||||
v = c.GetDefault("badKey", "baz")
|
||||
if v != "baz" {
|
||||
t.Errorf("Value should be baz, was %s", v)
|
||||
}
|
||||
})
|
||||
|
||||
r.ServeHTTP(w, req)
|
||||
|
Loading…
x
Reference in New Issue
Block a user