Skip to content

Commit 6660f81

Browse files
Dean KarnDean Karn
authored andcommitted
Merge pull request #4 from bluesuncorp/v1
Fix PanicMatches Bug
2 parents 20603e5 + f1e668e commit 6660f81

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

assert.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ func PanicMatchesSkip(t *testing.T, skip int, fn func(), matches string) {
120120
fmt.Printf("%s:%d Panic... expected [%s] received [%s]", path.Base(file), line, matches, err)
121121
t.FailNow()
122122
}
123+
} else {
124+
fmt.Printf("Panic expected, none found, expected [%v] ", matches)
125+
t.FailNow()
123126
}
124127
}()
125128

assert_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ func TestBasicAllGood(t *testing.T) {
3939
PanicMatches(t, func() { fn() }, "omg omg omg!")
4040
PanicMatches(t, func() { panic("omg omg omg!") }, "omg omg omg!")
4141

42+
/* if you uncomment creates hard fail, that is expected
43+
// you cant really do this, but it is here for the sake of completeness
44+
fun := func() {}
45+
PanicMatches(t, func() { fun() }, "omg omg omg!")
46+
*/
4247
errs := map[string]string{}
4348
errs["Name"] = "User Name Invalid"
4449
errs["Email"] = "User Email Invalid"

0 commit comments

Comments
 (0)