changeset 230:0dd9da7489dc

Test for scoped operation of HgStatusCollector
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 31 May 2011 05:33:16 +0200
parents 1ec6b327a6ac
children 1792b37650f2
files test/org/tmatesoft/hg/test/TestStatus.java
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/TestStatus.java	Tue May 31 05:23:07 2011 +0200
+++ b/test/org/tmatesoft/hg/test/TestStatus.java	Tue May 31 05:33:16 2011 +0200
@@ -361,6 +361,32 @@
 		assertTrue(r.getIgnored().contains(file3));
 	}
 	
+	@Test
+	public void testScopeInHistoricalStatus() throws Exception {
+		repo = Configuration.get().find("status-1");
+		HgStatusCommand cmd = new HgStatusCommand(repo);
+		cmd.base(3).revision(8).all();
+		cmd.match(new PathGlobMatcher("dir/*"));
+		StatusCollector sc = new StatusCollector();
+		cmd.execute(sc);
+		final Path file3 = Path.create("dir/file3");
+		final Path file4 = Path.create("dir/file4");
+		final Path file5 = Path.create("dir/file5");
+		//
+		assertTrue(sc.get(file3).contains(Removed));
+		assertTrue(sc.get(file3).size() == 1);
+		assertTrue(sc.get(Removed).size() == 1);
+		//
+		assertTrue(sc.get(file4).contains(Clean));
+		assertTrue(sc.get(file4).size() == 1);
+		assertTrue(sc.get(Clean).size() == 1);
+		//
+		assertTrue(sc.get(file5).contains(Added));
+		assertTrue(sc.get(file5).size() == 1);
+		assertTrue(sc.get(Added).size() == 1);
+
+	}
+	
 	/*
 	 * With warm-up of previous tests, 10 runs, time in milliseconds
 	 * 'hg status -A': Native client total 953 (95 per run), Java client 94 (9)