comparison test/org/tmatesoft/hg/test/TestStatus.java @ 283:7a8e1a305a78

Ignored tests shall be valid tests nevertheless
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 03 Sep 2011 13:10:12 +0200
parents e51dd9a14b6f
children 150500515714
comparison
equal deleted inserted replaced
282:e51dd9a14b6f 283:7a8e1a305a78
66 test.testStatusCommand(); 66 test.testStatusCommand();
67 test.testPerformance(); 67 test.testPerformance();
68 test.errorCollector.verify(); 68 test.errorCollector.verify();
69 // 69 //
70 TestStatus t2 = new TestStatus(new HgLookup().detect("/temp/hg/hg4j-merging/hg4j")); 70 TestStatus t2 = new TestStatus(new HgLookup().detect("/temp/hg/hg4j-merging/hg4j"));
71 t2.testDirstateParentOtherThanTip(238); 71 t2.testDirstateParentOtherThanTipWithUpdate();
72 t2.errorCollector.verify(); 72 t2.errorCollector.verify();
73 TestStatus t3 = new TestStatus(new HgLookup().detect("/temp/hg/cpython")); 73 TestStatus t3 = new TestStatus(new HgLookup().detect("/temp/hg/cpython"));
74 t3.testDirstateParentOtherThanTip(-1); 74 t3.testDirstateParentOtherThanTipNoUpdate();
75 t3.errorCollector.verify(); 75 t3.errorCollector.verify();
76 } 76 }
77 77
78 public TestStatus() throws Exception { 78 public TestStatus() throws Exception {
79 this(new HgLookup().detectFromWorkingDir()); 79 this(new HgLookup().detectFromWorkingDir());
120 * To check if HgWorkingCopyStatusCollector respects actual working copy parent (takes from dirstate) 120 * To check if HgWorkingCopyStatusCollector respects actual working copy parent (takes from dirstate)
121 * and if status is calculated correctly 121 * and if status is calculated correctly
122 */ 122 */
123 @Test 123 @Test
124 @Ignore("modifies test repository, needs careful configuration") 124 @Ignore("modifies test repository, needs careful configuration")
125 public void testDirstateParentOtherThanTip(int revToUpdate) throws Exception { 125 public void testDirstateParentOtherThanTipWithUpdate() throws Exception {
126 int revToUpdate = 238;
127 try {
128 eh.run("hg", "up", "--rev", String.valueOf(revToUpdate));
129 testDirstateParentOtherThanTipNoUpdate();
130 } finally {
131 eh.run("hg", "up");
132 }
133 }
134
135 @Test
136 @Ignore("needs configuration as it requires special repository")
137 public void testDirstateParentOtherThanTipNoUpdate() throws Exception {
126 final HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(repo); 138 final HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(repo);
127 statusParser.reset(); 139 statusParser.reset();
128 try { 140 //
129 if (revToUpdate != -1) { 141 eh.run("hg", "status", "-A");
130 // there are repositories (like cpython) where WC is not tip-based, and no need to 142 HgStatusCollector.Record r = wcc.status(HgRepository.TIP);
131 // accomplish that artificially 143 report("hg status -A", r, statusParser);
132 eh.run("hg", "up", "--rev", String.valueOf(revToUpdate)); 144 //
133 } 145 statusParser.reset();
134 // 146 int revision = 3;
135 eh.run("hg", "status", "-A"); 147 eh.run("hg", "status", "-A", "--rev", String.valueOf(revision));
136 HgStatusCollector.Record r = wcc.status(HgRepository.TIP); 148 r = wcc.status(revision);
137 report("hg status -A", r, statusParser); 149 report("status -A --rev " + revision, r, statusParser);
138 //
139 statusParser.reset();
140 int revision = 3;
141 eh.run("hg", "status", "-A", "--rev", String.valueOf(revision));
142 r = wcc.status(revision);
143 report("status -A --rev " + revision, r, statusParser);
144 } finally {
145 if (revToUpdate != -1) {
146 // bring the repository to the tip just in case anyone else is using it afterwards
147 eh.run("hg", "up");
148 }
149 }
150 } 150 }
151 151
152 152
153 @Test 153 @Test
154 public void testStatusCommand() throws Exception { 154 public void testStatusCommand() throws Exception {