Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/TestHistory.java @ 101:777ab7034c1b
Switch to JUnit for tests
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 28 Jan 2011 03:07:25 +0100 |
parents | b71b3f7d24d4 |
children | a3a2e5deb320 |
comparison
equal
deleted
inserted
replaced
100:b71b3f7d24d4 | 101:777ab7034c1b |
---|---|
18 | 18 |
19 import java.util.Collections; | 19 import java.util.Collections; |
20 import java.util.Iterator; | 20 import java.util.Iterator; |
21 import java.util.List; | 21 import java.util.List; |
22 | 22 |
23 import org.junit.Test; | |
23 import org.tmatesoft.hg.core.Cset; | 24 import org.tmatesoft.hg.core.Cset; |
24 import org.tmatesoft.hg.core.LogCommand; | 25 import org.tmatesoft.hg.core.LogCommand; |
25 import org.tmatesoft.hg.core.StatusCommand; | |
26 import org.tmatesoft.hg.core.LogCommand.CollectHandler; | 26 import org.tmatesoft.hg.core.LogCommand.CollectHandler; |
27 import org.tmatesoft.hg.core.LogCommand.FileHistoryHandler; | 27 import org.tmatesoft.hg.core.LogCommand.FileHistoryHandler; |
28 import org.tmatesoft.hg.core.LogCommand.FileRevision; | 28 import org.tmatesoft.hg.core.LogCommand.FileRevision; |
29 import org.tmatesoft.hg.core.Path; | 29 import org.tmatesoft.hg.core.Path; |
30 import org.tmatesoft.hg.repo.HgLookup; | |
30 import org.tmatesoft.hg.repo.HgRepository; | 31 import org.tmatesoft.hg.repo.HgRepository; |
31 import org.tmatesoft.hg.repo.HgLookup; | |
32 import org.tmatesoft.hg.repo.HgStatusCollector; | |
33 import org.tmatesoft.hg.test.LogOutputParser.Record; | 32 import org.tmatesoft.hg.test.LogOutputParser.Record; |
34 | 33 |
35 | 34 |
36 /** | 35 /** |
37 * | 36 * |
43 private final HgRepository repo; | 42 private final HgRepository repo; |
44 private ExecHelper eh; | 43 private ExecHelper eh; |
45 private LogOutputParser changelogParser; | 44 private LogOutputParser changelogParser; |
46 | 45 |
47 public static void main(String[] args) throws Exception { | 46 public static void main(String[] args) throws Exception { |
48 TestHistory th = new TestHistory(new HgLookup().detectFromWorkingDir()); | 47 TestHistory th = new TestHistory(); |
49 th.testCompleteLog(); | 48 th.testCompleteLog(); |
50 th.testFollowHistory(); | 49 th.testFollowHistory(); |
51 th.testPerformance(); | 50 th.testPerformance(); |
52 } | 51 } |
52 | |
53 public TestHistory() throws Exception { | |
54 this(new HgLookup().detectFromWorkingDir()); | |
55 } | |
53 | 56 |
54 public TestHistory(HgRepository hgRepo) { | 57 private TestHistory(HgRepository hgRepo) { |
55 repo = hgRepo; | 58 repo = hgRepo; |
56 eh = new ExecHelper(changelogParser = new LogOutputParser(true), null); | 59 eh = new ExecHelper(changelogParser = new LogOutputParser(true), null); |
57 } | 60 } |
58 | 61 |
62 @Test | |
59 public void testCompleteLog() throws Exception { | 63 public void testCompleteLog() throws Exception { |
60 changelogParser.reset(); | 64 changelogParser.reset(); |
61 eh.run("hg", "log", "--debug"); | 65 eh.run("hg", "log", "--debug"); |
62 List<Cset> r = new LogCommand(repo).execute(); | 66 List<Cset> r = new LogCommand(repo).execute(); |
63 report("hg log - COMPLETE REPO HISTORY", r, true); | 67 report("hg log - COMPLETE REPO HISTORY", r, true); |
64 } | 68 } |
65 | 69 |
70 @Test | |
66 public void testFollowHistory() throws Exception { | 71 public void testFollowHistory() throws Exception { |
67 final Path f = Path.create("cmdline/org/tmatesoft/hg/console/Remote.java"); | 72 final Path f = Path.create("cmdline/org/tmatesoft/hg/console/Remote.java"); |
68 try { | 73 try { |
69 if (repo.getFileNode(f).exists()) { // FIXME getFileNode shall not fail with IAE | 74 if (repo.getFileNode(f).exists()) { // FIXME getFileNode shall not fail with IAE |
70 changelogParser.reset(); | 75 changelogParser.reset(); |