add test function

This commit is contained in:
guonaihong 2019-08-14 21:23:01 +08:00
parent 5b9692dc3b
commit 895518e3b0
1 changed files with 13 additions and 0 deletions

View File

@ -14,6 +14,19 @@ import (
"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) {
var s struct {
FileValue multipart.FileHeader `form:"file"`