From 895518e3b01b8757e54add347e4534a2e8f983f8 Mon Sep 17 00:00:00 2001 From: guonaihong Date: Wed, 14 Aug 2019 21:23:01 +0800 Subject: [PATCH] add test function --- binding/multipart_form_mapping_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/binding/multipart_form_mapping_test.go b/binding/multipart_form_mapping_test.go index 4c75d1fe..60b5cbfe 100644 --- a/binding/multipart_form_mapping_test.go +++ b/binding/multipart_form_mapping_test.go @@ -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"`