# HG changeset patch # User Artem Tikhomirov # Date 1295839102 -3600 # Node ID e62f9638fb27027215d1b6fbcca74a4e0fe479c2 # Parent 6f1b88693d48422e98c3eaaa8428ffd4d4d98ca7 Modified test to check copied files diff -r 6f1b88693d48 -r e62f9638fb27 test/org/tmatesoft/hg/test/StatusOutputParser.java --- a/test/org/tmatesoft/hg/test/StatusOutputParser.java Mon Jan 24 03:14:45 2011 +0100 +++ b/test/org/tmatesoft/hg/test/StatusOutputParser.java Mon Jan 24 04:18:22 2011 +0100 @@ -87,7 +87,7 @@ } // last added is copy destination // to get or to remove it - depends on what StatusCollector does in this case - copied.put(fname, added.get(added.size() - 1)); + copied.put(added.get(added.size() - 1), fname); break; } } diff -r 6f1b88693d48 -r e62f9638fb27 test/org/tmatesoft/hg/test/TestStatus.java --- a/test/org/tmatesoft/hg/test/TestStatus.java Mon Jan 24 03:14:45 2011 +0100 +++ b/test/org/tmatesoft/hg/test/TestStatus.java Mon Jan 24 04:18:22 2011 +0100 @@ -19,8 +19,10 @@ import static org.tmatesoft.hg.repo.HgRepository.TIP; import java.util.Collection; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import org.tmatesoft.hg.core.StatusCommand; import org.tmatesoft.hg.repo.HgRepository; @@ -104,6 +106,28 @@ reportNotEqual("IGNORED", r.getIgnored(), statusParser.getIgnored()); reportNotEqual("MISSING", r.getMissing(), statusParser.getMissing()); reportNotEqual("UNKNOWN", r.getUnknown(), statusParser.getUnknown()); + List copiedKeyDiff = difference(r.getCopied().keySet(), statusParser.getCopied().keySet()); + HashMap copyDiff = new HashMap(); + if (copiedKeyDiff.isEmpty()) { + for (String jk : r.getCopied().keySet()) { + String jv = r.getCopied().get(jk); + if (statusParser.getCopied().containsKey(jk)) { + String cmdv = statusParser.getCopied().get(jk); + if (!jv.equals(cmdv)) { + copyDiff.put(jk, jv + " instead of " + cmdv); + } + } else { + copyDiff.put(jk, "ERRONEOUSLY REPORTED IN JAVA"); + } + } + } + System.out.println("COPIED" + (copiedKeyDiff.isEmpty() && copyDiff.isEmpty() ? " are the same" : " are NOT the same:")); + for (String s : copiedKeyDiff) { + System.out.println("\tNon-matching key:" + s); + } + for (String s : copyDiff.keySet()) { + System.out.println(s + " : " + copyDiff.get(s)); + } // TODO compare equals System.out.println("<<<\n"); }