Fix native CI and keep snapshot checks read-only
Handle private queue actions in the native log renderer's exhaustive match. Keep CI fixtures read-only to prevent parallel readers seeing truncated files and to fail snapshot mismatches directly. Refresh the stale Epic-length and Conversion-log expectations, and strengthen Great Gardens coverage with legal-target and positive-control assertions.
This commit is contained in:
parent
deeb023a3d
commit
6a6829ec92
5 changed files with 50 additions and 11 deletions
|
|
@ -377,6 +377,10 @@ fn draw_action(drawer: &mut RichTextDrawer, body: &ActionLogBody) {
|
|||
}
|
||||
},
|
||||
Action::Response(r) => draw_response_action(drawer, r),
|
||||
// Private queue revisions are live updates, never committed log entries.
|
||||
Action::QueueMoves { .. } | Action::QueueChoice { .. } => {
|
||||
panic!("Unexpected queued action in log");
|
||||
}
|
||||
Action::Undo => panic!("Unexpected undo in log"),
|
||||
Action::Redo => panic!("Unexpected redo in log"),
|
||||
Action::StartTurn => panic!("Unexpected start turn in log"),
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ run = [
|
|||
"cargo nextest run",
|
||||
"git diff --exit-code || exit 1", # Check if there are any uncommitted changes updating JSON files
|
||||
]
|
||||
env = { UPDATE_EXPECTED = "true", RUSTFLAGS = '' }
|
||||
# CI compares snapshots; rewriting shared fixtures races with parallel readers.
|
||||
# Keep snapshot updates opt-in through the update-tests task above.
|
||||
env = { UPDATE_EXPECTED = "false", RUSTFLAGS = '' }
|
||||
|
||||
[tasks.profile]
|
||||
description = "Run AI client with profiling"
|
||||
|
|
|
|||
|
|
@ -241,7 +241,8 @@ fn builder_combines_with_epic_and_civilization_draft_and_survives_save_load() {
|
|||
let cache = Cache::new(&data.options);
|
||||
let game = Game::from_data(data, cache, GameContext::Play);
|
||||
assert!(game.options.variant == GameVariant::Builder);
|
||||
assert_eq!(game.options.length.ages(), 10);
|
||||
assert!(game.options.length == GameLength::Epic);
|
||||
assert_eq!(game.options.length.ages(), 8);
|
||||
assert!(game.civilization_draft.is_none());
|
||||
assert!(!game.map.tiles.is_empty());
|
||||
assert_eq!(game.cache.get_objective_card(20).name(), "Science Focus");
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@
|
|||
},
|
||||
{
|
||||
"player": 1,
|
||||
"Text": "rolls a 2 and now has the option to pay 3 culture tokens to increase the dice roll and proceed with the cultural influence",
|
||||
"Text": "rolls a 1 (+1) and now has the option to pay 3 culture tokens to increase the dice roll and proceed with the cultural influence",
|
||||
"origin": {
|
||||
"Ability": "Influence Culture"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,15 +171,47 @@ fn test_great_gardens() {
|
|||
TestAction::not_undoable(0, Action::Playing(PlayingAction::EndTurn)).skip_json(),
|
||||
TestAction::undoable(1, move_action(vec![0, 1], Position::from_offset("B1")))
|
||||
.with_post_assert(|mut game| {
|
||||
let result = execute_without_undo(
|
||||
&mut game,
|
||||
move_action(vec![0, 1], Position::from_offset("A1")),
|
||||
use server::movement::{MovementRestriction, possible_move_routes};
|
||||
|
||||
let start = Position::from_offset("B1");
|
||||
let destination = Position::from_offset("A1");
|
||||
let can_attack = |game: &server::game::Game| {
|
||||
possible_move_routes(game.player(1), game, &[0, 1], start, None)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.any(|route| route.destination == destination)
|
||||
};
|
||||
assert!(
|
||||
!can_attack(&game),
|
||||
"Great Gardens must not be a legal target"
|
||||
);
|
||||
let error = execute_without_undo(
|
||||
&mut game.clone(),
|
||||
move_action(vec![0, 1], destination),
|
||||
1,
|
||||
);
|
||||
assert_eq!(
|
||||
result.err(),
|
||||
Some("fertile movement attack great gardens restriction".to_string())
|
||||
);
|
||||
)
|
||||
.unwrap_err();
|
||||
// Route selection now wraps the specific rejection with
|
||||
// destination/payment diagnostics. Keep checking the rule.
|
||||
assert!(error.contains("fertile movement attack great gardens restriction"));
|
||||
|
||||
// Positive control: remove only the Grassland restriction,
|
||||
// leaving the same units, target, route and payment.
|
||||
for id in [0, 1] {
|
||||
let unit = game.player_mut(1).get_unit_mut(id);
|
||||
assert!(
|
||||
unit.movement_restrictions
|
||||
.contains(&MovementRestriction::Fertile)
|
||||
);
|
||||
unit.movement_restrictions
|
||||
.retain(|restriction| *restriction != MovementRestriction::Fertile);
|
||||
}
|
||||
assert!(can_attack(&game));
|
||||
execute_without_undo(&mut game, move_action(vec![0, 1], destination), 1)
|
||||
.unwrap();
|
||||
for id in [0, 1] {
|
||||
assert_eq!(game.player(1).get_unit(id).position, destination);
|
||||
}
|
||||
}),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue