Mercurial > jhg
changeset 62:25819103de17
Few more tests for status
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 18 Jan 2011 18:42:01 +0100 |
parents | fac8e7fcc8b0 |
children | a47530a2ea12 |
files | test/com/tmate/hgkit/TestStatus.java |
diffstat | 1 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 <T> void reportNotEqual(String what, Collection<T> l1, Collection<T> l2) {