From 8e21c716c7fb3b5e52b793935340fd99e4ddb814 Mon Sep 17 00:00:00 2001 From: alessio Date: Sun, 13 Aug 2017 00:53:17 +0200 Subject: [PATCH] bytes compare --- style/style_test.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/style/style_test.go b/style/style_test.go index b424576..087b228 100644 --- a/style/style_test.go +++ b/style/style_test.go @@ -1,20 +1,21 @@ package style import ( - "testing" "fmt" + "bytes" + "testing" ) func TestColorBase_Regular(t *testing.T) { c := new(colorBase) strs := []string{"a", "b", "c"} input := make([]interface{}, len(strs)) - result := c.Bold(input) - expected := fmt.Sprint(input) for i, s := range strs { input[i] = s } - if result != expected{ + result := c.Regular(input) + expected := fmt.Sprint(input) + if !bytes.Equal([]byte(result), []byte(expected)){ t.Error("Expected:", expected, "instead", result) } } @@ -23,12 +24,12 @@ func TestColorBase_Bold(t *testing.T) { c := new(colorBase) strs := []string{"a", "b", "c"} input := make([]interface{}, len(strs)) - result := c.Bold(input) - expected := fmt.Sprint(input) for i, s := range strs { input[i] = s } - if result != expected{ + result := c.Bold(input) + expected := fmt.Sprint(input) + if !bytes.Equal([]byte(result), []byte(expected)){ t.Error("Expected:", expected, "instead", result) } -} \ No newline at end of file +}