From 98ee5434ef02856cc9289f546c38d12a3244fe15 Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Thu, 18 Dec 2014 07:59:41 +0100 Subject: [PATCH] Make the test more robust --- text_formatter_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/text_formatter_test.go b/text_formatter_test.go index 4e956c9..f604f1b 100644 --- a/text_formatter_test.go +++ b/text_formatter_test.go @@ -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)