realize/style_test.go
2017-11-08 16:52:57 +01:00

37 lines
836 B
Go

package main
import (
"bytes"
"fmt"
"github.com/fatih/color"
"testing"
)
func TestStyle_Regular(t *testing.T) {
strs := []string{"a", "b", "c"}
input := make([]interface{}, len(strs))
for i, s := range strs {
input[i] = s
}
result := red.regular(input)
c := color.New(color.FgHiRed).SprintFunc()
expected := fmt.Sprint(c(input))
if !bytes.Equal([]byte(result), []byte(expected)) {
t.Error("Expected:", expected, "instead", result)
}
}
func TestStyle_Bold(t *testing.T) {
strs := []string{"a", "b", "c"}
input := make([]interface{}, len(strs))
for i, s := range strs {
input[i] = s
}
result := red.bold(input)
c := color.New(color.FgHiRed, color.Bold).SprintFunc()
expected := fmt.Sprint(c(input))
if !bytes.Equal([]byte(result), []byte(expected)) {
t.Error("Expected:", expected, "instead", result)
}
}