mirror of https://github.com/gin-gonic/gin.git
add test function
This commit is contained in:
parent
5b9692dc3b
commit
895518e3b0
|
@ -14,6 +14,19 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestFormMultipartBindingOneFileToBytesArrayFail(t *testing.T) {
|
||||||
|
var test struct {
|
||||||
|
Voice []byte `form:"voice"`
|
||||||
|
}
|
||||||
|
|
||||||
|
file := testFile{"voice", "test.pcm", []byte("pcm pcm pcm")}
|
||||||
|
req := createRequestMultipartFiles(t, file)
|
||||||
|
err := FormMultipart.Bind(req, &test)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
assert.Equal(t, test.Voice, []byte("pcm pcm pcm"))
|
||||||
|
}
|
||||||
|
|
||||||
func TestFormMultipartBindingBindOneFile(t *testing.T) {
|
func TestFormMultipartBindingBindOneFile(t *testing.T) {
|
||||||
var s struct {
|
var s struct {
|
||||||
FileValue multipart.FileHeader `form:"file"`
|
FileValue multipart.FileHeader `form:"file"`
|
||||||
|
|
Loading…
Reference in New Issue