From 552f42cc96125d2ec6d26654260b7ee448ab8f6c Mon Sep 17 00:00:00 2001 From: ekzyis Date: Wed, 18 Sep 2024 05:39:57 +0200 Subject: [PATCH] Fix SIGSEGV in tests --- chess/board_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chess/board_test.go b/chess/board_test.go index 4231e8b..62bc5de 100644 --- a/chess/board_test.go +++ b/chess/board_test.go @@ -81,9 +81,10 @@ func assertPiece(t *testing.T, b *chess.Board, position string, name chess.Piece msg := fmt.Sprintf("expected %s %s at %s", c, name, position) - assert.NotNil(t, p, msg) - assert.Equal(t, name, p.Name, msg) - assert.Equal(t, color, p.Color, msg) + if assert.NotNil(t, p, msg) { + assert.Equal(t, name, p.Name, msg) + assert.Equal(t, color, p.Color, msg) + } } func assertNoPiece(t *testing.T, b *chess.Board, position string) {