13 #++ $totalBad unless $ok ;
16 print "ok $count\n" if $ok ;
17 print "not ok $count\n" unless $ok ;
18 #printf "# Failed test at line %d\n", (caller)[2] unless $ok ;
25 my($filename, @strings) = @_ ;
26 open (F, ">$filename")
27 or die "Cannot open $filename: $!\n" ;
39 open (F, "<$filename")
40 or die "Cannot open $filename: $!\n" ;
53 $msg .= "\n" unless $msg =~ /\n\Z/;
60 my $expected = shift ;
62 my $stderr = 'err.out';
65 my $cmd = "$command 2>$stderr";
71 or diag " exit status is $?" ;
73 $aok &= ok readFile($stderr) eq ''
74 or diag "Stderr is: " . readFile($stderr);
76 if (defined $expected ) {
77 $aok &= ok $stdout eq $expected
78 or diag "got content:\n". $stdout;
82 diag "Command line: $cmd";
83 my ($file, $line) = (caller)[1,2];
84 diag "Test called from $file, line $line";
92 my $Inc = join " ", map qq["-I$_"] => @INC;
93 $Inc = '"-MExtUtils::testlib"'
94 if ! $ENV{PERL_CORE} && eval "require ExtUtils::testlib;" ;
97 $Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;
98 $Perl = qq["$Perl"] if $^O eq 'MSWin32' ;
100 $Perl = "$Perl -w $Inc" ;
101 my $examples = $ENV{PERL_CORE} ? "../ext/Compress/Zlib/examples"
114 my @hello1 = grep(s/$/\n/, split(/\n/, $hello1)) ;
127 my @hello2 = grep(s/$/\n/, split(/\n/, $hello2)) ;
129 my $file1 = "hello1.gz" ;
130 my $file2 = "hello2.gz" ;
131 my $stderr = "err.out" ;
134 my $gz = gzopen($file1, "wb");
135 $gz->gzwrite($hello1);
138 $gz = gzopen($file2, "wb");
139 $gz->gzwrite($hello2);
149 check "$Perl ${examples}/gzcat $file1 $file2", $hello1 . $hello2 ;
154 check "$Perl ${examples}/gzgrep the $file1 $file2",
155 join('', grep(/the/, @hello1, @hello2));
158 unlink $file1, $file2 ;
165 writeFile($file1, $hello1) ;
166 writeFile($file2, $hello2) ;
168 # there's no way to set binmode on backticks in Win32 so we won't use $a later
169 check "$Perl ${examples}/filtdef $file1 $file2"; ;
171 check "$Perl ${examples}/filtdef $file1 $file2 | $Perl ${examples}/filtinf 2>$stderr", $hello1 . $hello2;
177 writeFile($file1, $hello1) ;
178 check "$Perl ${examples}/gzstream <$file1 >$file2" ;
180 check "$Perl ${examples}/gzcat $file2", $hello1;
187 for ($file1, $file2, $stderr) { 1 while unlink $_ } ;