add test function

This commit is contained in:
guonaihong 2019-08-15 21:17:07 +08:00
parent 93567f91e6
commit 27a8f77311
1 changed files with 19 additions and 1 deletions

View File

@ -14,7 +14,25 @@ import (
"github.com/stretchr/testify/assert" "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 { var test struct {
Voice []byte `form:"voice"` Voice []byte `form:"voice"`
} }