2
package org.crosswire.bible.view.cli;
4
import java.io.PrintWriter;
5
import java.util.Enumeration;
6
import java.util.Hashtable;
8
import org.crosswire.bible.control.test.TestList;
9
import org.crosswire.bible.util.Project;
10
import org.crosswire.util.TestBase;
13
* Test is a command line utility that runs all the configured tests.
14
* <p>I may at some stage add some functionality to select the tests
17
* <table border='1' cellPadding='3' cellSpacing='0' width="100%">
18
* <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
19
* Distribution Licence:<br />
20
* Project B is free software; you can redistribute it
21
* and/or modify it under the terms of the GNU General Public License,
22
* version 2 as published by the Free Software Foundation.<br />
23
* This program is distributed in the hope that it will be useful,
24
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
* General Public License for more details.<br />
27
* The License is available on the internet
28
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
29
* <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30
* MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
31
* The copyright to this program is held by it's authors.
32
* </font></td></tr></table>
33
* @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
34
* @see <{docs.Licence}>
43
public static void main(String[] args)
50
Enumeration en = hash.elements();
51
while (en.hasMoreElements())
53
TestBase all = (TestBase) en.nextElement();
54
all.test(new PrintWriter(System.out), false);
59
TestBase single = (TestBase) hash.get(args[0]);
63
single.test(new PrintWriter(System.out), false);
71
// Since the Swing test creates some dialogs we need this to
72
// make sure that we actually exit the program.
79
public static void usage()
81
System.out.println("Syntax: ctest [module]");
82
System.out.println(" Where [module] is blank to run all tests or one of:");
83
Enumeration en = hash.keys();
84
while (en.hasMoreElements())
86
String key = (String) en.nextElement();
87
TestBase test = (TestBase) hash.get(key);
88
System.out.println(" "+key+" (which runs "+test.getClass()+")");
92
/** The set of tests */
93
private static Hashtable hash = TestList.getTesters();