bytes compare
This commit is contained in:
parent
4c18e2a630
commit
8e21c716c7
@ -1,20 +1,21 @@
|
|||||||
package style
|
package style
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"bytes"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestColorBase_Regular(t *testing.T) {
|
func TestColorBase_Regular(t *testing.T) {
|
||||||
c := new(colorBase)
|
c := new(colorBase)
|
||||||
strs := []string{"a", "b", "c"}
|
strs := []string{"a", "b", "c"}
|
||||||
input := make([]interface{}, len(strs))
|
input := make([]interface{}, len(strs))
|
||||||
result := c.Bold(input)
|
|
||||||
expected := fmt.Sprint(input)
|
|
||||||
for i, s := range strs {
|
for i, s := range strs {
|
||||||
input[i] = s
|
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)
|
t.Error("Expected:", expected, "instead", result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,12 +24,12 @@ func TestColorBase_Bold(t *testing.T) {
|
|||||||
c := new(colorBase)
|
c := new(colorBase)
|
||||||
strs := []string{"a", "b", "c"}
|
strs := []string{"a", "b", "c"}
|
||||||
input := make([]interface{}, len(strs))
|
input := make([]interface{}, len(strs))
|
||||||
result := c.Bold(input)
|
|
||||||
expected := fmt.Sprint(input)
|
|
||||||
for i, s := range strs {
|
for i, s := range strs {
|
||||||
input[i] = s
|
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)
|
t.Error("Expected:", expected, "instead", result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user