test(core): add GameEngineLoadGameTest for loadGame/exportGame

Add 3 focused tests for GameEngine load/export functionality:
- loadGame with PgnParser validates PGN parsing and undo/redo state
- loadGame with FenParser validates position loading without move replay
- exportGame with PgnExporter validates PGN output

Fix: PgnParser now extends GameContextImport trait for consistency with FenParser.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-05 15:22:04 +02:00
parent e88f502ffc
commit 17fa13c82a
2 changed files with 45 additions and 1 deletions
@@ -3,6 +3,7 @@ package de.nowchess.io.pgn
import de.nowchess.api.board.*
import de.nowchess.api.move.{Move, MoveType, PromotionPiece}
import de.nowchess.api.game.{GameContext, HistoryMove}
import de.nowchess.io.GameContextImport
import de.nowchess.rules.sets.DefaultRules
/** A parsed PGN game containing headers and the resolved move list. */
@@ -11,7 +12,7 @@ case class PgnGame(
moves: List[HistoryMove]
)
object PgnParser:
object PgnParser extends GameContextImport:
/** Strictly validate a PGN text.
* Returns Right(PgnGame) if every move token is a legal move in the evolving position.