mirror of https://github.com/gin-gonic/gin.git
add test function
This commit is contained in:
parent
93567f91e6
commit
27a8f77311
|
@ -14,7 +14,25 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestFormMultipartBindingOneFileToBytesArrayFail(t *testing.T) {
|
||||
func TestFormMultipartBindingOneFileToBytesFail1(t *testing.T) {
|
||||
var test struct {
|
||||
Voice []byte `form:"voice"`
|
||||
}
|
||||
|
||||
file := testFile{"voice", "test.pcm", []byte("pcm pcm pcm")}
|
||||
req := createRequestMultipartFiles(t, file)
|
||||
|
||||
err := req.ParseMultipartForm(3)
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = req.MultipartForm.RemoveAll()
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = mappingByPtr(&test, (*multipartRequest)(req), "form")
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
func TestFormMultipartBindingOneFileToBytesArray(t *testing.T) {
|
||||
var test struct {
|
||||
Voice []byte `form:"voice"`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue