From eebb759edba12e6fbe999e25b85b4d26a9dc7e6a Mon Sep 17 00:00:00 2001 From: Qi Xiao Date: Wed, 17 Feb 2016 01:43:58 +0100 Subject: [PATCH] Fully cover util/exception.go. --- util/exception_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/util/exception_test.go b/util/exception_test.go index 5b7ee618..8260f817 100644 --- a/util/exception_test.go +++ b/util/exception_test.go @@ -43,4 +43,14 @@ func TestException(t *testing.T) { if err != nil { t.Errorf("Catch recovered panic not caused via Throw") } + + // Catch should do nothing when there is no panic + err = nil + f = func() { + defer Catch(&err) + } + f() + if err != nil { + t.Errorf("Catch recovered something when there is no panic") + } }