Permalink
Browse files

don't FAIL due to test count error on systems without lua

The skip count was always off on systems without lua. We said we
skipped 6 tests, but it was 3 where the URL wasn't =~ /failo/.

It's easier to just skip the entire test suite on those systems, so
move the prereq for lua before the plan.

Also don't run each of those tests 10 times. There's no need.
  • Loading branch information...
1 parent 2fa0ddf commit d6fd4f2f17697979da2513d4fbe76609a91099aa @avar committed Oct 12, 2010
Showing with 32 additions and 31 deletions.
  1. +10 −0 Changes
  2. +22 −31 t/compile-quotes.t
View
10 Changes
@@ -2,6 +2,16 @@ Revision history for App::QuoteCC
{{$NEXT}}
+ - Don't FAIL due to test count error on systems without lua
+
+ The skip count was always off on systems without lua. We said we
+ skipped 6 tests, but it was 3 where the URL wasn't =~ /failo/.
+
+ It's easier to just skip the entire test suite on those systems, so
+ move the prereq for lua before the plan.
+
+ Also don't run each of those tests 10 times. There's no need.
+
0.09 2010-09-23 08:54:47
- Use the not-so-well-known dong string delimiting syntax in the
View
@@ -5,11 +5,12 @@ use Encode;
use File::Slurp qw(slurp);
use File::Temp qw<tempdir tempfile>;
-plan skip_all => "Need curl / gcc to test"
+plan skip_all => "Need curl / gcc / lua to test"
unless
qx[ curl --version ] =~ /^curl \d+\..*\nProtocols:/s and
- qx[ gcc --version ] =~ /Free Software Foundation/;
-plan tests => 380;
+ qx[ gcc --version ] =~ /Free Software Foundation/ and
+ qx[ lua -e 'require "posix"; print(string.format("The time is %s", os.time()));' ] =~ /^The time is \d+$/;
+plan tests => 65;
my @test = (
{
@@ -59,46 +60,36 @@ for my $compiler (qw/Perl C Lua/) {
given ($compiler) {
when ('Lua') {
- for (1..10) {
- SKIP: {
- skip "Don't have a Lua on this system", 6
- unless qx[ lua -e 'require "posix"; print(string.format("The time is %s", os.time()));' ] =~ /^The time is \d+$/;
- system "chmod +x $output";
+ system "chmod +x $output";
- chomp(my $quote = qx[lua $output]);
- ok($quote, "Got quote from $output");
+ chomp(my $quote = qx[lua $output]);
+ ok($quote, "Got quote from $output");
- chomp($quote = qx[lua $output --all]);
- ok($quote, "Got quote from $output --all");
- test_quotes_encoding($output, $quote, $url);
- }
- }
+ chomp($quote = qx[lua $output --all]);
+ ok($quote, "Got quote from $output --all");
+ test_quotes_encoding($output, $quote, $url);
}
when ('C') {
$cmd = qq[gcc -Wall $output -o $output.exe];
system $cmd;
- for (1..10) {
- chomp(my $quote = qx[$output.exe]);
- ok($quote, "Got quote from $output.exe");
+ chomp(my $quote = qx[$output.exe]);
+ ok($quote, "Got quote from $output.exe");
- chomp($quote = qx[$output.exe --all]);
- ok($quote, "Got quote from $output.exe --all");
- test_quotes_encoding($output, $quote, $url);
- }
+ chomp($quote = qx[$output.exe --all]);
+ ok($quote, "Got quote from $output.exe --all");
+ test_quotes_encoding($output, $quote, $url);
}
when ('Perl') {
- for (1..10) {
- my $raw = slurp($output);
- unlike($raw, qr/require MIME::Base64/, "Data::Dump didn't use modules");
+ my $raw = slurp($output);
+ unlike($raw, qr/require MIME::Base64/, "Data::Dump didn't use modules");
- chomp(my $quote = qx[$^X $output]);
- ok($quote, "Got quote from $^X $output");
- cmp_ok(length($quote), '>', 5, "quote was long enough");
+ chomp(my $quote = qx[$^X $output]);
+ ok($quote, "Got quote from $^X $output");
+ cmp_ok(length($quote), '>', 5, "quote was long enough");
- chomp($quote = qx[$^X $output --all]);
- test_quotes_encoding($output, $quote, $url);
- }
+ chomp($quote = qx[$^X $output --all]);
+ test_quotes_encoding($output, $quote, $url);
}
}
}

0 comments on commit d6fd4f2

Please sign in to comment.