From 88c3f96e47157b66f3aa2627bf68f793000a54f9 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 10 Sep 2020 17:52:52 +0200 Subject: [PATCH] better test --- hexcolor_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hexcolor_test.go b/hexcolor_test.go index ac2e3cb..0cf6cd3 100644 --- a/hexcolor_test.go +++ b/hexcolor_test.go @@ -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 assert.NotNil(t, hc) { - assert.EqualValues(t, tc.hex, hc.hex) + if tc.err { + assert.Error(t, err) + } else { + assert.NoError(t, err) + if assert.NotNil(t, hc) { + assert.EqualValues(t, tc.hex, hc.hex) + } } } }