# HG changeset patch # User Artem Tikhomirov # Date 1295372521 -3600 # Node ID 25819103de175b8d9bfbe3eba27f0261ed22208a # Parent fac8e7fcc8b0767eaadb30f02565a96c78826e9c Few more tests for status diff -r fac8e7fcc8b0 -r 25819103de17 test/com/tmate/hgkit/TestStatus.java --- a/test/com/tmate/hgkit/TestStatus.java Tue Jan 18 18:32:49 2011 +0100 +++ b/test/com/tmate/hgkit/TestStatus.java Tue Jan 18 18:42:01 2011 +0100 @@ -21,14 +21,30 @@ public class TestStatus { public static void main(String[] args) throws Exception { + HgRepository repo = new RepositoryLookup().detectFromWorkingDir(); + final WorkingCopyStatusCollector wcc = new WorkingCopyStatusCollector(repo, new FileWalker(new File(System.getProperty("user.dir")))); final StatusOutputParser statusParser = new StatusOutputParser(); ExecHelper eh = new ExecHelper(statusParser, null); + // eh.run("hg", "status", "-A"); - // run java equivalent - HgRepository repo = new RepositoryLookup().detectFromWorkingDir(); - final WorkingCopyStatusCollector wcc = new WorkingCopyStatusCollector(repo, new FileWalker(new File(System.getProperty("user.dir")))); StatusCollector.Record r = wcc.status(HgRepository.TIP); - // compare result + report("hg status -A", r, statusParser); + // + statusParser.reset(); + int revision = 3; + eh.run("hg", "status", "-A", "--rev", String.valueOf(revision)); + r = wcc.status(revision); + report("status -A --rev " + revision, r, statusParser); + // + statusParser.reset(); + eh.run("hg", "status", "-A", "--change", String.valueOf(revision)); + r = new StatusCollector.Record(); + new StatusCollector(repo).change(revision, r); + report("status -A --change " + revision, r, statusParser); + } + + private static void report(String what, StatusCollector.Record r, StatusOutputParser statusParser) { + System.out.println(">>>" + what); reportNotEqual("MODIFIED", r.getModified(), statusParser.getModified()); reportNotEqual("ADDED", r.getAdded(), statusParser.getAdded()); reportNotEqual("REMOVED", r.getRemoved(), statusParser.getRemoved()); @@ -37,6 +53,7 @@ reportNotEqual("MISSING", r.getMissing(), statusParser.getMissing()); reportNotEqual("UNKNOWN", r.getUnknown(), statusParser.getUnknown()); // TODO compare equals + System.out.println("<<<\n"); } private static void reportNotEqual(String what, Collection l1, Collection l2) {