Make the test more robust

This commit is contained in:
Giovanni Bajo 2014-12-18 07:59:41 +01:00
parent a3ef049df9
commit 98ee5434ef
1 changed files with 3 additions and 3 deletions

View File

@ -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)