diff --git a/client/src/log_ui.rs b/client/src/log_ui.rs index 39e198c2..a7a4bdda 100644 --- a/client/src/log_ui.rs +++ b/client/src/log_ui.rs @@ -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"), diff --git a/mise.toml b/mise.toml index 8f178959..7d45587b 100644 --- a/mise.toml +++ b/mise.toml @@ -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" diff --git a/server/tests/builder_tests.rs b/server/tests/builder_tests.rs index d6512c72..c873cd2a 100644 --- a/server/tests/builder_tests.rs +++ b/server/tests/builder_tests.rs @@ -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"); diff --git a/server/tests/test_games/advances/cultural_influence_with_conversion.outcome2.json b/server/tests/test_games/advances/cultural_influence_with_conversion.outcome2.json index edd82ea7..800275db 100644 --- a/server/tests/test_games/advances/cultural_influence_with_conversion.outcome2.json +++ b/server/tests/test_games/advances/cultural_influence_with_conversion.outcome2.json @@ -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" } diff --git a/server/tests/wonder_tests.rs b/server/tests/wonder_tests.rs index 3268d6fc..47b46e5c 100644 --- a/server/tests/wonder_tests.rs +++ b/server/tests/wonder_tests.rs @@ -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); + } }), ], );