improve utils code coverage (#1473)

This commit is contained in:
田欧 2018-08-12 21:38:07 +08:00 committed by Bo-Yi Wu
parent e5bb4f62a2
commit 202db4fb11

View File

@ -5,6 +5,8 @@
package gin
import (
"bytes"
"encoding/xml"
"fmt"
"net/http"
"testing"
@ -124,3 +126,14 @@ func TestBindMiddleware(t *testing.T) {
Bind(&bindTestStruct{})
})
}
func TestMarshalXMLforH(t *testing.T) {
h := H{
"": "test",
}
var b bytes.Buffer
enc := xml.NewEncoder(&b)
var x xml.StartElement
e := h.MarshalXML(enc, x)
assert.Error(t, e)
}