-
Notifications
You must be signed in to change notification settings - Fork 1
/
wrap_test.go
94 lines (62 loc) · 1.89 KB
/
wrap_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package log
import (
"testing"
"github.com/echocat/slf4g/internal/test/assert"
)
func Test_UnwrapCoreLogger_withNil(t *testing.T) {
actual := UnwrapCoreLogger(nil)
assert.ToBeNil(t, actual)
}
func Test_UnwrapCoreLogger_withoutUnwrapMethod(t *testing.T) {
given := newMockCoreLogger("foo")
actual := UnwrapCoreLogger(given)
assert.ToBeNil(t, actual)
}
func Test_UnwrapCoreLogger_withCoreUnwrapMethod(t *testing.T) {
wrapped := newMockCoreLogger("foo")
given := newWrappingCoreLogger(wrapped)
actual := UnwrapCoreLogger(given)
assert.ToBeSame(t, wrapped, actual)
}
func Test_UnwrapCoreLogger_withUnwrapMethod(t *testing.T) {
wrapped := newMockLogger("foo")
given := newWrappingLogger(wrapped)
actual := UnwrapCoreLogger(given)
assert.ToBeSame(t, wrapped, actual)
}
func Test_UnwrapLogger_withNil(t *testing.T) {
actual := UnwrapLogger(nil)
assert.ToBeNil(t, actual)
}
func Test_UnwrapLogger_withoutUnwrapMethod(t *testing.T) {
given := &mockCoreLogger{}
actual := UnwrapLogger(given)
assert.ToBeNil(t, actual)
}
func Test_UnwrapLogger_withCoreUnwrapMethod(t *testing.T) {
wrapped := newMockLogger("foo")
given := &wrappingCoreLogger{wrapped}
actual := UnwrapLogger(given)
assert.ToBeSame(t, wrapped, actual)
}
func Test_UnwrapLogger_withUnwrapMethod(t *testing.T) {
wrapped := newMockLogger("foo")
given := newWrappingLogger(wrapped)
actual := UnwrapLogger(given)
assert.ToBeSame(t, wrapped, actual)
}
func Test_UnwrapProvider_withNil(t *testing.T) {
actual := UnwrapProvider(nil)
assert.ToBeNil(t, actual)
}
func Test_UnwrapProvider_withoutUnwrapMethod(t *testing.T) {
given := newMockProvider("test")
actual := UnwrapProvider(given)
assert.ToBeNil(t, actual)
}
func Test_UnwrapProvider_withUnwrapMethod(t *testing.T) {
wrapped := newMockProvider("test")
given := newWrappingProvider(wrapped)
actual := UnwrapProvider(given)
assert.ToBeSame(t, wrapped, actual)
}