test(@projects/@magic-civilization): ✅ assert expected engine errors in negative-path tests (p2_46, prologue)
These tests deliberately feed bad input (missing/malformed replay game_id, no-history goto_turn, malformed start-script JSON) and the Rust bindings correctly log an engine error + reject it. GUT's auto error-check flagged those deliberate logs as "Unexpected Errors". Use assert_engine_error(text) to mark them expected (GUT marks the matching error handled). Clears test_p2_46_replay_bridge (4→0) + the prologue load_script rejection path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
169e890fce
commit
e3aefc9f12
2 changed files with 9 additions and 0 deletions
|
|
@ -69,6 +69,11 @@ func test_open_returns_false_for_missing_game() -> void:
|
|||
var ok_malformed: bool = archive.open(_archive_root, "age-of-dwarves", "not-a-uuid")
|
||||
assert_false(ok_malformed, "open() must return false for a malformed game_id")
|
||||
|
||||
# Both open() calls deliberately log engine errors for the bad input —
|
||||
# mark them expected so GUT doesn't flag them as unexpected.
|
||||
assert_engine_error("archive io error")
|
||||
assert_engine_error("invalid game_id")
|
||||
|
||||
|
||||
## Assertion 3: goto_turn() on an unloaded GdReplayPlayer returns an empty
|
||||
## Dictionary (the safe default when no history is loaded).
|
||||
|
|
@ -77,6 +82,8 @@ func test_goto_turn_returns_empty_dict_when_no_history() -> void:
|
|||
var snap: Dictionary = player.goto_turn(1)
|
||||
assert_true(snap is Dictionary, "goto_turn() must return a Dictionary")
|
||||
assert_eq(snap.size(), 0, "goto_turn() with no loaded history must return empty Dictionary")
|
||||
# goto_turn with no loaded history deliberately logs an engine error — expected.
|
||||
assert_engine_error("no history loaded")
|
||||
|
||||
|
||||
## Helper: remove a directory tree recursively (best-effort, ignores errors).
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ func test_load_script_accepts_default_rejects_garbage_when_available() -> void:
|
|||
assert_ne(script_json, "", "default start script readable")
|
||||
assert_true(driver.load_script(script_json), "load_script accepts the bundled default")
|
||||
assert_false(driver.load_script("{ not valid json"), "load_script rejects malformed JSON")
|
||||
# The malformed-JSON rejection deliberately logs an engine error — expected.
|
||||
assert_engine_error("malformed script JSON")
|
||||
|
||||
|
||||
func test_dispatch_chronicle_events_routes_to_eventbus() -> void:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue