|
@@ -6,6 +6,7 @@ import (
|
6
|
6
|
"fmt"
|
7
|
7
|
"testing"
|
8
|
8
|
|
|
9
|
+ "github.com/stretchr/testify/assert"
|
9
|
10
|
"github.com/stretchr/testify/require"
|
10
|
11
|
)
|
11
|
12
|
|
|
@@ -40,3 +41,25 @@ func TestNoFieldValueError(t *testing.T) {
|
40
|
41
|
_, ok := data[FieldKeyLogrusError]
|
41
|
42
|
require.False(t, ok)
|
42
|
43
|
}
|
|
44
|
+
|
|
45
|
+func TestWarninglnNotEqualToWarning(t *testing.T) {
|
|
46
|
+ buf := &bytes.Buffer{}
|
|
47
|
+ bufln := &bytes.Buffer{}
|
|
48
|
+
|
|
49
|
+ formatter := new(TextFormatter)
|
|
50
|
+ formatter.DisableTimestamp = true
|
|
51
|
+ formatter.DisableLevelTruncation = true
|
|
52
|
+
|
|
53
|
+ l := &Logger{
|
|
54
|
+ Out: buf,
|
|
55
|
+ Formatter: formatter,
|
|
56
|
+ Hooks: make(LevelHooks),
|
|
57
|
+ Level: DebugLevel,
|
|
58
|
+ }
|
|
59
|
+ l.Warning("hello,", "world")
|
|
60
|
+
|
|
61
|
+ l.SetOutput(bufln)
|
|
62
|
+ l.Warningln("hello,", "world")
|
|
63
|
+
|
|
64
|
+ assert.NotEqual(t, buf.String(), bufln.String(), "Warning() and Wantingln() should not be equal")
|
|
65
|
+}
|