diff test/org/tmatesoft/hg/test/TestAuxUtilities.java @ 445:d0e5dc3cae6e smartgit3

Support for phases functionality from Mercurial 2.1
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 05 Jun 2012 20:50:06 +0200
parents 2fadf8695f8a
children 2e402c12ebc6
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/TestAuxUtilities.java	Wed Mar 21 14:54:02 2012 +0100
+++ b/test/org/tmatesoft/hg/test/TestAuxUtilities.java	Tue Jun 05 20:50:06 2012 +0200
@@ -244,9 +244,14 @@
 				}
 			}
 		});
-		fileNode.walk(0, TIP, new HgDataFile.ParentInspector() {
-			int i = 0;
-			Nodeid[] all = new Nodeid[fileNode.getRevisionCount()];
+		class ParentInspectorCheck implements HgDataFile.ParentInspector {
+			private int i;
+			private Nodeid[] all;
+			
+			public ParentInspectorCheck(int start, int total) {
+				i = start;
+				all = new Nodeid[total];
+			}
 
 			public void next(int localRevision, Nodeid revision, int parent1, int parent2, Nodeid nidParent1, Nodeid nidParent2) {
 				Assert.assertEquals(i++, localRevision);
@@ -264,7 +269,11 @@
 					Assert.assertTrue(nidParent2 == all[parent2]);  
 				}
 			}
-		});
+		}; 
+		fileNode.walk(0, TIP, new ParentInspectorCheck(0, fileNode.getRevisionCount()));
+		assert fileNode.getRevisionCount() > 2 : "prereq"; // need at least few revisions
+		// there used to be a defect in #walk impl, assumption all parents come prior to a revision
+		fileNode.walk(1, 3, new ParentInspectorCheck(1, 3));
 	}
 
 	@Test