mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 18:22:23 +08:00
assert order
This commit is contained in:
parent
ecea8b57f6
commit
0d2480e10f
@ -478,8 +478,8 @@ func TestBindingDefaultValueFormPost(t *testing.T) {
|
|||||||
var obj FooDefaultBarStruct
|
var obj FooDefaultBarStruct
|
||||||
FormPost.Bind(req, &obj)
|
FormPost.Bind(req, &obj)
|
||||||
|
|
||||||
assert.Equal(t, obj.Foo, "bar")
|
assert.Equal(t, "bar", obj.Foo)
|
||||||
assert.Equal(t, obj.Bar, "hello")
|
assert.Equal(t, "hello", obj.Bar)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBindingFormPostFail(t *testing.T) {
|
func TestBindingFormPostFail(t *testing.T) {
|
||||||
@ -612,7 +612,7 @@ func testFormBinding(t *testing.T, method, path, badPath, body, badBody string)
|
|||||||
|
|
||||||
func testFormBindingDefaultValue(t *testing.T, method, path, badPath, body, badBody string) {
|
func testFormBindingDefaultValue(t *testing.T, method, path, badPath, body, badBody string) {
|
||||||
b := Form
|
b := Form
|
||||||
assert.Equal(t, b.Name(), "form")
|
assert.Equal(t, "form", b.Name())
|
||||||
|
|
||||||
obj := FooDefaultBarStruct{}
|
obj := FooDefaultBarStruct{}
|
||||||
req := requestWithBody(method, path, body)
|
req := requestWithBody(method, path, body)
|
||||||
@ -621,8 +621,8 @@ func testFormBindingDefaultValue(t *testing.T, method, path, badPath, body, badB
|
|||||||
}
|
}
|
||||||
err := b.Bind(req, &obj)
|
err := b.Bind(req, &obj)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, obj.Foo, "bar")
|
assert.Equal(t, "bar", obj.Foo)
|
||||||
assert.Equal(t, obj.Bar, "hello")
|
assert.Equal(t, "hello", obj.Bar)
|
||||||
|
|
||||||
obj = FooDefaultBarStruct{}
|
obj = FooDefaultBarStruct{}
|
||||||
req = requestWithBody(method, badPath, badBody)
|
req = requestWithBody(method, badPath, badBody)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user