structure_test: cover panicing of Name()

This commit is contained in:
Fatih Arslan 2014-08-08 12:53:38 +03:00
parent 76f7c2b740
commit 563e458c93

View File

@ -779,4 +779,13 @@ func TestName(t *testing.T) {
if m != "" { if m != "" {
t.Error("Name should return empty string for unnamed struct, got: %s", n) t.Error("Name should return empty string for unnamed struct, got: %s", n)
} }
defer func() {
err := recover()
if err == nil {
t.Error("Name should panic if a non struct is passed")
}
}()
Name([]string{})
} }