Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tests: exercise graph neighborliness in arrange
  • Loading branch information
higgsd committed Mar 14, 2026
commit 5e2f574a40d5bb8f9d25ac048e269ba5b35bf977
12 changes: 12 additions & 0 deletions cli/src/commands/arrange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,12 @@ mod tests {
]
);

// C is only a neighbor of B
assert!(!state.are_graph_neighbors(1, 0));
assert!(!state.are_graph_neighbors(1, 1));
assert!(state.are_graph_neighbors(1, 2));
assert!(!state.are_graph_neighbors(1, 3));

// Update parents and head order and check that the commit order changes.
state.commits.get_mut(commit_a.id()).unwrap().parents = vec![commit_c.id().clone()];
state.commits.get_mut(commit_b.id()).unwrap().parents =
Expand All @@ -703,6 +709,12 @@ mod tests {
commit_b.id().clone(),
]
);

// C is now a neighbor of A and B
assert!(!state.are_graph_neighbors(2, 0));
assert!(state.are_graph_neighbors(2, 1));
assert!(!state.are_graph_neighbors(2, 2));
assert!(state.are_graph_neighbors(2, 3));
}

#[test]
Expand Down