Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/TestStatus.java @ 75:e62f9638fb27
Modified test to check copied files
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 24 Jan 2011 04:18:22 +0100 |
parents | 6f1b88693d48 |
children | 658fa6b3a371 |
comparison
equal
deleted
inserted
replaced
74:6f1b88693d48 | 75:e62f9638fb27 |
---|---|
17 package org.tmatesoft.hg.test; | 17 package org.tmatesoft.hg.test; |
18 | 18 |
19 import static org.tmatesoft.hg.repo.HgRepository.TIP; | 19 import static org.tmatesoft.hg.repo.HgRepository.TIP; |
20 | 20 |
21 import java.util.Collection; | 21 import java.util.Collection; |
22 import java.util.HashMap; | |
22 import java.util.LinkedList; | 23 import java.util.LinkedList; |
23 import java.util.List; | 24 import java.util.List; |
25 import java.util.Map; | |
24 | 26 |
25 import org.tmatesoft.hg.core.StatusCommand; | 27 import org.tmatesoft.hg.core.StatusCommand; |
26 import org.tmatesoft.hg.repo.HgRepository; | 28 import org.tmatesoft.hg.repo.HgRepository; |
27 import org.tmatesoft.hg.repo.Lookup; | 29 import org.tmatesoft.hg.repo.Lookup; |
28 import org.tmatesoft.hg.repo.StatusCollector; | 30 import org.tmatesoft.hg.repo.StatusCollector; |
102 reportNotEqual("REMOVED", r.getRemoved(), statusParser.getRemoved()); | 104 reportNotEqual("REMOVED", r.getRemoved(), statusParser.getRemoved()); |
103 reportNotEqual("CLEAN", r.getClean(), statusParser.getClean()); | 105 reportNotEqual("CLEAN", r.getClean(), statusParser.getClean()); |
104 reportNotEqual("IGNORED", r.getIgnored(), statusParser.getIgnored()); | 106 reportNotEqual("IGNORED", r.getIgnored(), statusParser.getIgnored()); |
105 reportNotEqual("MISSING", r.getMissing(), statusParser.getMissing()); | 107 reportNotEqual("MISSING", r.getMissing(), statusParser.getMissing()); |
106 reportNotEqual("UNKNOWN", r.getUnknown(), statusParser.getUnknown()); | 108 reportNotEqual("UNKNOWN", r.getUnknown(), statusParser.getUnknown()); |
109 List<String> copiedKeyDiff = difference(r.getCopied().keySet(), statusParser.getCopied().keySet()); | |
110 HashMap<String, String> copyDiff = new HashMap<String,String>(); | |
111 if (copiedKeyDiff.isEmpty()) { | |
112 for (String jk : r.getCopied().keySet()) { | |
113 String jv = r.getCopied().get(jk); | |
114 if (statusParser.getCopied().containsKey(jk)) { | |
115 String cmdv = statusParser.getCopied().get(jk); | |
116 if (!jv.equals(cmdv)) { | |
117 copyDiff.put(jk, jv + " instead of " + cmdv); | |
118 } | |
119 } else { | |
120 copyDiff.put(jk, "ERRONEOUSLY REPORTED IN JAVA"); | |
121 } | |
122 } | |
123 } | |
124 System.out.println("COPIED" + (copiedKeyDiff.isEmpty() && copyDiff.isEmpty() ? " are the same" : " are NOT the same:")); | |
125 for (String s : copiedKeyDiff) { | |
126 System.out.println("\tNon-matching key:" + s); | |
127 } | |
128 for (String s : copyDiff.keySet()) { | |
129 System.out.println(s + " : " + copyDiff.get(s)); | |
130 } | |
107 // TODO compare equals | 131 // TODO compare equals |
108 System.out.println("<<<\n"); | 132 System.out.println("<<<\n"); |
109 } | 133 } |
110 | 134 |
111 private static <T> void reportNotEqual(String what, Collection<T> l1, Collection<T> l2) { | 135 private static <T> void reportNotEqual(String what, Collection<T> l1, Collection<T> l2) { |