From 7904bb5a36dcdf1185ad3fadfcbe5b18ae45a8c4 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Wed, 12 Jun 2024 23:04:23 -0600 Subject: [PATCH] add test --- lib/tests/test_revset.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/tests/test_revset.rs b/lib/tests/test_revset.rs index 27207084fcd..41fb229458d 100644 --- a/lib/tests/test_revset.rs +++ b/lib/tests/test_revset.rs @@ -1816,6 +1816,24 @@ fn test_evaluate_expression_descendants() { commit3.id().clone(), ] ); + + // Can find next n descendants of a commit + assert_eq!( + resolve_commit_ids(mut_repo, &format!("descendants({}, 0)", commit2.id().hex())), + vec![] + ); + assert_eq!( + resolve_commit_ids(mut_repo, &format!("descendants({}, 1)", commit3.id().hex())), + vec![commit3.id().clone()] + ); + assert_eq!( + resolve_commit_ids(mut_repo, &format!("descendants({}, 3)", commit3.id().hex())), + vec![ + commit3.id().clone(), + commit4.id().clone(), + commit5.id().clone(), + ] + ); } #[test]