X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=tests%2Frun-px;h=0f8f29648aa21f2df19a2068c628772e081bfe51;hp=febb0de4db001ada69b256443d21398624d206fa;hb=1777835073cad695bce04848aa6f33e9686e7fc1;hpb=e17633e99c3eff326ace71ed6970c491aa42845c diff --git a/tests/run-px b/tests/run-px index febb0de4..0f8f2964 100755 --- a/tests/run-px +++ b/tests/run-px @@ -1,17 +1,26 @@ #!/usr/bin/env perl + +use 5.006; +use strict; use warnings; +use Term::ANSIColor ':constants'; +$Term::ANSIColor::AUTORESET = 1; + die "Please specify the top source directory.\n" if (!@ARGV); my $top_srcdir = shift @ARGV; my @tests = ( 'Test-auth-basic.px', + 'Test-auth-no-challenge.px', + 'Test-auth-no-challenge-url.px', 'Test-proxy-auth-basic.px', 'Test-proxied-https-auth.px', 'Test-N-HTTP-Content-Disposition.px', 'Test--spider.px', 'Test-c-full.px', 'Test-c-partial.px', + 'Test-c-shorter.px', 'Test-c.px', 'Test-E-k-K.px', 'Test-E-k.px', @@ -36,6 +45,7 @@ my @tests = ( 'Test-O--no-content-disposition-trivial.px', 'Test-O-nonexisting.px', 'Test-O.px', + 'Test-O-nc.px', 'Test-Restrict-Lowercase.px', 'Test-Restrict-Uppercase.px', 'Test--spider-fail.px', @@ -45,19 +55,56 @@ my @tests = ( 'Test--spider-r.px', ); -my @results; +my @tested; -for my $test (@tests) { +foreach my $test (@tests) { print "Running $test\n\n"; - system("$top_srcdir/tests/$test"); - push @results, $?; + system("$^X $top_srcdir/tests/$test"); + push @tested, { name => $test, result => $? }; } -for (my $i=0; $i != @tests; ++$i) { - if ($results[$i] == 0) { - print "pass: "; - } else { - print "FAIL: "; - } - print "$tests[$i]\n"; +print "\n"; +foreach my $test (@tested) { + ($test->{result} == 0) + ? print GREEN 'pass: ' + : print RED 'FAIL: '; + print $test->{name}, "\n"; } + +my $count = sub +{ + return { + pass => sub { scalar grep $_->{result} == 0, @tested }, + fail => sub { scalar grep $_->{result} != 0, @tested }, + }->{$_[0]}->(); +}; + +my $summary = sub +{ + my @lines = ( + "${\scalar @tested} tests were run", + "${\$count->('pass')} PASS, ${\$count->('fail')} FAIL", + ); + my $len_longest = sub + { + local $_ = 0; + foreach my $line (@lines) { + if (length $line > $_) { + $_ = length $line; + } + } + return $_; + }->(); + return join "\n", + '=' x $len_longest, + @lines, + '=' x $len_longest; +}->(); + +print "\n"; +print $count->('fail') + ? RED $summary + : GREEN $summary; +print "\n"; + +exit $count->('fail');