Doug MacEachern wrote:

On Thu, 18 Oct 2001, Stas Bekman wrote:


is there anything else we need to do with opts parsing at this stage?


now that we know all args and which are meant as test files, anything else should throw an error. for example what ken saw:

% t/TEST t/notexist

currently ignores t/notexist and runs all tests instead.


this patch does that:

Index: Apache-Test/lib/Apache/TestRun.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.60
diff -u -r1.60 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm 2001/10/18 02:44:36 1.60
+++ Apache-Test/lib/Apache/TestRun.pm 2001/10/18 03:43:04
@@ -88,6 +88,7 @@
my(@tests);


my $argv = $self->{argv};
+ my @leftovers = ();
for (@$argv) {
my $arg = $_;
#need the t/ for stat-ing, but dont want to include it in test output
@@ -117,11 +118,25 @@
next;
}
}
+ push @leftovers, $_;
}


     $self->{tests} = [EMAIL PROTECTED];
+    $self->{argv}  = [EMAIL PROTECTED];
 }

+sub die_on_invalid_args {
+    my($self) = @_;
+
+    # at this stage $self->{argv} should be empty
+    my @invalid_argv = @{ $self->{argv} };
+    if (@invalid_argv) {
+        error "unknown opts or test names: @invalid_argv";
+        exit;
+    }
+
+}
+
 sub passenv {
     my $passenv = Apache::TestConfig->passenv;
     for (keys %$passenv) {
@@ -517,6 +532,8 @@
     $self->default_run_opts;

     $self->split_test_args;
+
+    $self->die_on_invalid_args;

     $self->start;



_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Reply via email to