summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2005-10-10 21:45:55 +0200
committerAndreas Gohr <andi@splitbrain.org>2005-10-10 21:45:55 +0200
commit5327e1bbc03b079fffc07a4bafc4bdde4ef1eac0 (patch)
tree5ee12e429460b7b81846ea800b15bb5df93cb8df
parent861b902983a81b0c4f000ab8cb0b21f14e475e8a (diff)
downloadrpg-5327e1bbc03b079fffc07a4bafc4bdde4ef1eac0.tar.gz
rpg-5327e1bbc03b079fffc07a4bafc4bdde4ef1eac0.tar.bz2
removed PEAR:CLIOpts dependency from testframework
darcs-hash:20051010194555-7ad00-3362e1d9b52b4ccb7f837f557f0b33b6b127459f.gz
-rwxr-xr-xtest/runtests.php82
1 files changed, 39 insertions, 43 deletions
diff --git a/test/runtests.php b/test/runtests.php
index bd8a38b74..5e9bea983 100755
--- a/test/runtests.php
+++ b/test/runtests.php
@@ -42,53 +42,49 @@ $opt_casefile = FALSE;
$opt_groupfile = FALSE;
/* only allow cmd line options if PEAR Console_Getopt is available */
-@include_once 'Console/Getopt.php'; /* PEAR lib */
-if (class_exists('Console_Getopt')) {
+include_once(DOKU_INC.'inc/cliopts.php');
- $argv = Console_Getopt::readPHPArgv();
- if (PEAR::isError($argv)) {
- die('Fatal Error: ' . $argv->getMessage()) . "\n";
- }
-
- $short_opts = "f:g:hls:p:";
- $long_opts = array("help", "file=", "group=", "list", "separator=", "path=");
- $options = Console_Getopt::getopt($argv, $short_opts, $long_opts);
- if (PEAR::isError($options)) {
- usage($available_grouptests);
- }
+$short_opts = "f:g:hls:p:";
+$long_opts = array("help", "file=", "group=", "list", "separator=", "path=");
+$OPTS = Doku_Cli_Opts::getOptions(__FILE__,$short_opts,$long_opts);
+if ( $OPTS->isError() ) {
+ fwrite( STDERR, $OPTS->getMessage() . "\n");
+ usage($available_grouptests);
+ exit(1);
+}
- foreach ($options[0] as $option) {
- switch ($option[0]) {
- case 'h':
- case '--help':
- usage();
- break;
- case 'f':
- case '--file':
- $opt_casefile = $option[1];
- break;
- case 'g':
- case '--group':
- $opt_groupfile = $option[1];
- break;
- case 'l':
- case '--list':
- $opt_list = TRUE;
- break;
- case 's':
- case '--separator':
- $opt_separator = $option[1];
- break;
- case 'p':
- case '--path':
- if (file_exists($option[1])) {
- define('SIMPLE_TEST', $option[1]);
- }
- break;
- }
- }
+foreach ($OPTS->options as $key => $val) {
+ switch ($key) {
+ case 'h':
+ case 'help':
+ usage();
+ break;
+ case 'f':
+ case 'file':
+ $opt_casefile = $val;
+ break;
+ case 'g':
+ case 'group':
+ $opt_groupfile = $val;
+ break;
+ case 'l':
+ case 'list':
+ $opt_list = TRUE;
+ break;
+ case 's':
+ case 'separator':
+ $opt_separator = $val;
+ break;
+ case 'p':
+ case 'path':
+ if (file_exists($val)) {
+ define('SIMPLE_TEST', $val);
+ }
+ break;
+ }
}
+
if (!@include_once SIMPLE_TEST . 'reporter.php') {
die("Where's Simple Test ?!? Not at ".SIMPLE_TEST);
}