diff --git a/src/logic/future_moves.rs b/src/logic/future_moves.rs index 4903a62..7f203f3 100644 --- a/src/logic/future_moves.rs +++ b/src/logic/future_moves.rs @@ -374,7 +374,7 @@ mod tests { lazy_children: false, }); - futm.current_root = Some(0); + futm.update_root_idx_raw(0); // child 1 futm.arena.push(Move::new( @@ -442,9 +442,23 @@ mod tests { lazy_children: false, }); - futm.current_root = Some(0); + futm.update_root_idx_raw(0); futm.extend_layers(); assert_eq!(futm.arena_len(), 5); + + // move to a child + futm.update_root_idx_raw(1); + futm.refocus_tree(); + assert_eq!(futm.arena_len(), 1); + + // make sure current_root is properly updated + assert_eq!(futm.current_root, Some(0)); + + futm.extend_layers(); + assert!( + futm.arena_len() > 1, + "extend_layer didn't grow arena after refocus" + ); } }