2020-02-21 03:05:28 +08:00
|
|
|
package colorschemes
|
|
|
|
|
|
|
|
import (
|
2020-04-28 09:33:41 +08:00
|
|
|
"github.com/shibukawa/configdir"
|
|
|
|
"path/filepath"
|
2020-02-21 03:05:28 +08:00
|
|
|
"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(".")
|
2020-02-21 03:05:28 +08:00
|
|
|
for _, cn := range colors {
|
2020-04-28 09:33:41 +08:00
|
|
|
c, e := FromName(cd, cn)
|
2020-02-21 03:05:28 +08:00
|
|
|
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.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|