This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Scalar-List-Utils to CPAN version 1.26
[perl5.git] / cpan / IO-Zlib / t / uncomp1.t
CommitLineData
8d0ec8cf
RGS
1use IO::Zlib;
2
3sub ok
4{
5 my ($no, $ok) = @_ ;
6
7 #++ $total ;
8 #++ $totalBad unless $ok ;
9
10 print "ok $no\n" if $ok ;
11 print "not ok $no\n" unless $ok ;
12}
13
14print "1..10\n";
15
16$hello = <<EOM ;
17hello world
18this is a test
19EOM
20
1cdea1e2 21$name = "test$$";
8d0ec8cf
RGS
22
23if (open(FH, ">$name")) {
24 binmode FH;
25 print FH $hello;
26 close FH;
27} else {
28 die "$name: $!";
29}
30
31ok(1, $file = IO::Zlib->new());
32ok(2, $file->open($name, "rb"));
33ok(3, !$file->eof());
34ok(4, $file->read($uncomp, 1024) == length($hello));
35ok(5, $file->eof());
36ok(6, $file->opened());
37ok(7, $file->close());
38ok(8, !$file->opened());
39
40unlink($name);
41
42ok(9, $hello eq $uncomp);
43
44ok(10, !defined(IO::Zlib->new($name, "rb")));
45