mirror of https://github.com/sirupsen/logrus.git
Make the test more robust
This commit is contained in:
parent
a3ef049df9
commit
98ee5434ef
|
@ -8,12 +8,12 @@ import (
|
|||
)
|
||||
|
||||
func TestQuoting(t *testing.T) {
|
||||
tf := new(TextFormatter)
|
||||
tf := &TextFormatter{DisableColors: true}
|
||||
|
||||
checkQuoting := func(q bool, value interface{}) {
|
||||
b, _ := tf.Format(WithField("test", value))
|
||||
idx := bytes.LastIndex(b, []byte{'='})
|
||||
cont := bytes.Contains(b[idx:], []byte{'"'})
|
||||
idx := bytes.Index(b, ([]byte)("test="))
|
||||
cont := bytes.Contains(b[idx+5:], []byte{'"'})
|
||||
if cont != q {
|
||||
if q {
|
||||
t.Errorf("quoting expected for: %#v", value)
|
||||
|
|
Loading…
Reference in New Issue