mirror of
https://github.com/6543/go-hexcolor
synced 2024-12-18 15:54:17 +00:00
better test
This commit is contained in:
parent
7185dc6b49
commit
88c3f96e47
@ -20,13 +20,13 @@ func TestNewHexColor(t *testing.T) {
|
||||
|
||||
for _, tc := range cases {
|
||||
hc, err := NewHexColor(tc.color)
|
||||
if tc.err && err == nil {
|
||||
t.Fatalf("expected error for color: %q", tc.color)
|
||||
} else if !tc.err && err != nil {
|
||||
t.Fatalf("error for color %q: %s", tc.color, err)
|
||||
}
|
||||
if tc.err {
|
||||
assert.Error(t, err)
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
if assert.NotNil(t, hc) {
|
||||
assert.EqualValues(t, tc.hex, hc.hex)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user