Don't accept empty input in DecodeInto

This commit is contained in:
Daniel Smith
2014-10-16 13:38:18 -07:00
parent 414ae795b2
commit 71126e79d1
2 changed files with 10 additions and 0 deletions

View File

@@ -290,6 +290,9 @@ func TestBadJSONRejection(t *testing.T) {
if err := s.DecodeInto(badJSONKindMismatch, &TestType1{}); err == nil {
t.Errorf("Kind is set but doesn't match the object type: %s", badJSONKindMismatch)
}
if err := s.DecodeInto([]byte(``), &TestType1{}); err == nil {
t.Errorf("Did not give error for empty data")
}
}
func TestBadJSONRejectionForSetInternalVersion(t *testing.T) {