comparison test/org/tmatesoft/hg/test/ExecHelper.java @ 570:36853bb80a35

Tests for HgAnnotateCommand with follow/no-follow option
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 11 Apr 2013 16:07:17 +0200
parents 7f27122011c3
children
comparison
equal deleted inserted replaced
569:c4fd1037bc6f 570:36853bb80a35
1 /* 1 /*
2 * Copyright (c) 2011-2012 TMate Software Ltd 2 * Copyright (c) 2011-2013 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
17 package org.tmatesoft.hg.test; 17 package org.tmatesoft.hg.test;
18 18
19 import java.io.File; 19 import java.io.File;
20 import java.io.IOException; 20 import java.io.IOException;
21 import java.util.ArrayList; 21 import java.util.ArrayList;
22 import java.util.Arrays;
22 import java.util.List; 23 import java.util.List;
23 import java.util.StringTokenizer; 24 import java.util.StringTokenizer;
24 25
25 import org.tmatesoft.hg.internal.ProcessExecHelper; 26 import org.tmatesoft.hg.internal.ProcessExecHelper;
26 27
27 /** 28 /**
28 * 29 * Utility to run a command line application and to parse its output
29 * @author Artem Tikhomirov 30 * @author Artem Tikhomirov
30 * @author TMate Software Ltd. 31 * @author TMate Software Ltd.
31 */ 32 */
32 public class ExecHelper extends ProcessExecHelper { 33 public class ExecHelper extends ProcessExecHelper {
33 34
59 } 60 }
60 } 61 }
61 return super.prepareCommand(cmd); 62 return super.prepareCommand(cmd);
62 } 63 }
63 64
64 public void run(String... cmd) throws IOException, InterruptedException { 65 public void run(List<String> cmd) throws IOException, InterruptedException {
65 CharSequence res = super.exec(cmd); 66 CharSequence res = super.exec(cmd);
66 parser.parse(res); 67 parser.parse(res);
68 }
69
70 public void run(String... cmd) throws IOException, InterruptedException {
71 run(Arrays.asList(cmd));
67 } 72 }
68 73
69 public int getExitValue() { 74 public int getExitValue() {
70 return super.exitValue(); 75 return super.exitValue();
71 } 76 }