Patchwork [1,of,3] test-ancestor: add a test for `ancestor` with ancestry within the initset

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 30, 2014, 3:02 p.m.
Message ID <2946d2de8d59cc79e274.1409410972@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5640/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 30, 2014, 3:02 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1409391555 -7200
#      Sat Aug 30 11:39:15 2014 +0200
# Node ID 2946d2de8d59cc79e2746f6e93209367bb14310e
# Parent  6debcc5a5f74a8d4d535fac6bb043f2b64aae873
test-ancestor: add a test for `ancestor` with ancestry within the initset

I was wondering if revision in the initial set that are still ancestors of other
elements in the initial set were yielded by `changelog.ancestors`. I now have my
answer (they does) and Mercurial has a new test.

Patch

diff --git a/tests/test-ancestor.py b/tests/test-ancestor.py
--- a/tests/test-ancestor.py
+++ b/tests/test-ancestor.py
@@ -89,10 +89,14 @@  def test_lazyancestors():
 
     # Standard example
     s = genlazyancestors([11, 13])
     printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0])
 
+    # Standard with ancestry in the initial set (1 is ancestor of 3)
+    s = genlazyancestors([1, 3])
+    printlazyancestors(s, [1, -1, 0])
+
     # Including revs
     s = genlazyancestors([11, 13], inclusive=True)
     printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0])
 
     # Test with stoprev
diff --git a/tests/test-ancestor.py.out b/tests/test-ancestor.py.out
--- a/tests/test-ancestor.py.out
+++ b/tests/test-ancestor.py.out
@@ -36,10 +36,12 @@ 
 [8, 13]
 % lazy ancestor set for [], stoprev = 0, inclusive = False
 []
 % lazy ancestor set for [11, 13], stoprev = 0, inclusive = False
 [7, 8, 3, 4, 1, 0]
+% lazy ancestor set for [1, 3], stoprev = 0, inclusive = False
+[1, 0]
 % lazy ancestor set for [11, 13], stoprev = 0, inclusive = True
 [11, 13, 7, 8, 3, 4, 1, 0]
 % lazy ancestor set for [11, 13], stoprev = 6, inclusive = False
 [7, 8]
 % lazy ancestor set for [11, 13], stoprev = 6, inclusive = True