| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package common_test |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "errors" |
||
| 5 | "testing" |
||
| 6 | |||
| 7 | "github.com/stefanoj3/dirstalk/pkg/common" |
||
| 8 | ) |
||
| 9 | |||
| 10 | func TestMustShouldNotPanicForNoErr(t *testing.T) { |
||
| 11 | defer func() { |
||
| 12 | if r := recover(); r != nil { |
||
| 13 | t.Fatal("no panic expected") |
||
| 14 | } |
||
| 15 | }() |
||
| 16 | |||
| 17 | common.Must(nil) |
||
| 18 | } |
||
| 19 | |||
| 20 | func TestMustShouldPanicOnErr(t *testing.T) { |
||
| 21 | defer func() { |
||
| 22 | if r := recover(); r == nil { |
||
| 23 | t.Fatal("panic expected") |
||
| 24 | } |
||
| 25 | }() |
||
| 26 | |||
| 27 | common.Must(errors.New("my error")) |
||
| 28 | } |
||
| 29 |