bytes compare

This commit is contained in:
alessio 2017-08-13 00:53:17 +02:00
parent 4c18e2a630
commit 8e21c716c7
1 changed files with 9 additions and 8 deletions

View File

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