diff --git a/chess/board.go b/chess/board.go index c80b37d..fd497c5 100644 --- a/chess/board.go +++ b/chess/board.go @@ -294,7 +294,6 @@ func (b *Board) Move(move string) error { // TODO: parse ambiguous captures for all pieces // TODO: parse checkmates e.g. e5# // TODO: parse O-O as kingside castle and O-O-O as queenside castle - // TODO: make sure pinned pieces cannot move move_ := func() error { diff --git a/chess/board_test.go b/chess/board_test.go index 86c4dbf..88d821e 100644 --- a/chess/board_test.go +++ b/chess/board_test.go @@ -472,6 +472,16 @@ func TestBoardCheck(t *testing.T) { assertParse(t, b, "Kxf7") } +func TestBoardPin(t *testing.T) { + t.Parallel() + + b := chess.NewBoard() + + assertParse(t, b, "d4 e5 Nc3 Bb4") + + assertMoveError(t, b, "Ne4", "invalid move Ne4: king is in check") +} + func assertParse(t *testing.T, b *chess.Board, moves string) { assert.NoError(t, b.Parse(moves)) }