aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Bell <madcityzen@gmail.com>2014-09-03 23:47:28 -0500
committerDoug Bell <madcityzen@gmail.com>2014-09-03 23:47:28 -0500
commit883f117643e91d213451f5aebde765e67d2706aa (patch)
tree33d54c36c4cfd598baeb146d47fbbacabf14ac60
parente92aabbbf6b02339cd160203f054f5f150d951f2 (diff)
runtests.pl: switch the order of arguments
Putting the spec file first lets us consume all the other arguments as the program to run. This makes it easier to use complex commands to run the tests.
-rw-r--r--runtests.pl10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtests.pl b/runtests.pl
index 5facbe6..2e2b795 100644
--- a/runtests.pl
+++ b/runtests.pl
@@ -5,13 +5,13 @@ use Term::ANSIColor;
use IO::Handle;
use IPC::Open2;
-my $usage="runtests.pl PROGRAM SPEC\nSet ANSI_COLORS_DISABLED=1 if you redirect to a file.\nSet PATT='...' to restrict tests to sections matching a regex.\n";
+my $usage="runtests.pl SPEC PROGRAM\nSet ANSI_COLORS_DISABLED=1 if you redirect to a file.\nSet PATT='...' to restrict tests to sections matching a regex.\n";
-my $PROG=$ARGV[0];
-my $SPEC=$ARGV[1];
+my $SPEC = shift @ARGV;
+my @PROG = @ARGV;
my $PATT=$ENV{'PATT'};
-if (!(defined $PROG && defined $SPEC)) {
+if (!(@PROG && defined $SPEC)) {
print STDERR $usage;
exit 1;
}
@@ -69,7 +69,7 @@ sub dotest
# We use → to indicate tab and ␣ space in the spec
$markdown =~ s/→/\t/g;s/␣/ /g;
$html =~ s/→/\t/g;s/␣/ /g;
- open2(my $out, my $in, $PROG);
+ open2(my $out, my $in, @PROG);
print $in $markdown;
close $in;
flush $out;