common_test.TestMustShouldNotPanicForNoErr   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 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