From 563e458c930308ac8bae3348eaac8b8241ac834e Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Fri, 8 Aug 2014 12:53:38 +0300 Subject: [PATCH] structure_test: cover panicing of Name() --- structure_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/structure_test.go b/structure_test.go index f3d1e51..3c822fe 100644 --- a/structure_test.go +++ b/structure_test.go @@ -779,4 +779,13 @@ func TestName(t *testing.T) { if m != "" { 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{}) }