Fully cover util/exception.go.

This commit is contained in:
Qi Xiao 2016-02-17 01:43:58 +01:00
parent 31fb99daa7
commit eebb759edb

View File

@ -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")
}
}