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 {
|
for _, tc := range cases {
|
||||||
hc, err := NewHexColor(tc.color)
|
hc, err := NewHexColor(tc.color)
|
||||||
if tc.err && err == nil {
|
if tc.err {
|
||||||
t.Fatalf("expected error for color: %q", tc.color)
|
assert.Error(t, err)
|
||||||
} else if !tc.err && err != nil {
|
} else {
|
||||||
t.Fatalf("error for color %q: %s", tc.color, err)
|
assert.NoError(t, err)
|
||||||
}
|
if assert.NotNil(t, hc) {
|
||||||
if assert.NotNil(t, hc) {
|
assert.EqualValues(t, tc.hex, hc.hex)
|
||||||
assert.EqualValues(t, tc.hex, hc.hex)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user