xmtop/colorschemes/registry_test.go

25 lines
618 B
Go
Raw Normal View History

package colorschemes
import (
2020-04-28 09:33:41 +08:00
"github.com/shibukawa/configdir"
"path/filepath"
"reflect"
"testing"
)
func TestColorRegistry(t *testing.T) {
colors := []string{"default", "default-dark", "solarized", "solarized16-dark", "solarized16-light", "monokai", "vice"}
zeroCS := Colorscheme{}
2020-04-28 09:33:41 +08:00
cd := configdir.New("", "gotop")
cd.LocalPath, _ = filepath.Abs(".")
for _, cn := range colors {
2020-04-28 09:33:41 +08:00
c, e := FromName(cd, cn)
if e != nil {
t.Errorf("unexpected error fetching built-in color %s: %s", cn, e)
}
if reflect.DeepEqual(c, zeroCS) {
t.Error("expected a colorscheme, but got back a zero value.")
}
}
}