Commit | Line | Data |
---|---|---|
8d0ec8cf RGS |
1 | use IO::Zlib; |
2 | ||
3 | sub 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 | ||
14 | print "1..10\n"; | |
15 | ||
16 | $hello = <<EOM ; | |
17 | hello world | |
18 | this is a test | |
19 | EOM | |
20 | ||
1cdea1e2 | 21 | $name = "test$$"; |
8d0ec8cf RGS |
22 | |
23 | if (open(FH, ">$name")) { | |
24 | binmode FH; | |
25 | print FH $hello; | |
26 | close FH; | |
27 | } else { | |
28 | die "$name: $!"; | |
29 | } | |
30 | ||
31 | ok(1, $file = IO::Zlib->new()); | |
32 | ok(2, $file->open($name, "rb")); | |
33 | ok(3, !$file->eof()); | |
34 | ok(4, $file->read($uncomp, 1024) == length($hello)); | |
35 | ok(5, $file->eof()); | |
36 | ok(6, $file->opened()); | |
37 | ok(7, $file->close()); | |
38 | ok(8, !$file->opened()); | |
39 | ||
40 | unlink($name); | |
41 | ||
42 | ok(9, $hello eq $uncomp); | |
43 | ||
44 | ok(10, !defined(IO::Zlib->new($name, "rb"))); | |
45 |