Fix Qex6 move
This commit is contained in:
parent
31d9ff02d5
commit
5729ae631a
@ -1330,6 +1330,11 @@ func getXY(position string) (int, int, error) {
|
|||||||
y int
|
y int
|
||||||
)
|
)
|
||||||
runes := []rune(position)
|
runes := []rune(position)
|
||||||
|
|
||||||
|
if len(runes) != 2 {
|
||||||
|
return -1, -1, fmt.Errorf("square does not exist: %s", position)
|
||||||
|
}
|
||||||
|
|
||||||
posX = runes[0]
|
posX = runes[0]
|
||||||
posY = runes[1]
|
posY = runes[1]
|
||||||
|
|
||||||
|
@ -13,4 +13,7 @@ func TestGame001(t *testing.T) {
|
|||||||
|
|
||||||
// this used to not parse because of the + at the end
|
// this used to not parse because of the + at the end
|
||||||
assertParse(t, b, "d4 d5 Bf4 Nf6 e3 Ne4 Nc3 Nf2 Kxf2 e6 Qg4 Be7 Re1 O-O Kg3 Bh4+")
|
assertParse(t, b, "d4 d5 Bf4 Nf6 e3 Ne4 Nc3 Nf2 Kxf2 e6 Qg4 Be7 Re1 O-O Kg3 Bh4+")
|
||||||
|
|
||||||
|
// this used to crash because of an out of bounds error (position was parsed as '6')
|
||||||
|
assertMoveError(t, b, "Qex6", "square does not exist")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user