diff test/org/tmatesoft/hg/test/RepoUtils.java @ 635:4ec2d44e2bf3

Compound test scenario for checkout, add, remove, revert and commit
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 06 Jun 2013 18:42:38 +0200
parents 8a5cdcb27b8f
children 4a0bab2c6da1
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/RepoUtils.java	Thu Jun 06 14:21:11 2013 +0200
+++ b/test/org/tmatesoft/hg/test/RepoUtils.java	Thu Jun 06 18:42:38 2013 +0200
@@ -30,6 +30,8 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 
+import junit.framework.Assert;
+
 import org.tmatesoft.hg.core.HgException;
 import org.tmatesoft.hg.core.HgIOException;
 import org.tmatesoft.hg.internal.FileUtils;
@@ -156,4 +158,16 @@
 			fw.close();
 		}
 	}
+
+	static void exec(File wd, int expectedRetVal, String... args) throws Exception {
+		OutputParser.Stub s = new OutputParser.Stub();
+		try {
+			ExecHelper eh = new ExecHelper(s, wd);
+			eh.run(args);
+			Assert.assertEquals(expectedRetVal, eh.getExitValue());
+		} catch (Exception ex) {
+			System.err.println(s.result());
+			throw ex;
+		}
+	}
 }