Mercurial > hg4j
changeset 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 |
files | test/org/tmatesoft/hg/test/StatusOutputParser.java test/org/tmatesoft/hg/test/TestStatus.java |
diffstat | 2 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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; } }
--- 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<String> copiedKeyDiff = difference(r.getCopied().keySet(), statusParser.getCopied().keySet()); + HashMap<String, String> copyDiff = new HashMap<String,String>(); + 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"); }