diff options
Diffstat (limited to 'lib/IO/Zlib/t/uncomp1.t')
-rw-r--r-- | lib/IO/Zlib/t/uncomp1.t | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/IO/Zlib/t/uncomp1.t b/lib/IO/Zlib/t/uncomp1.t new file mode 100644 index 0000000000..7e580ad032 --- /dev/null +++ b/lib/IO/Zlib/t/uncomp1.t @@ -0,0 +1,45 @@ +use IO::Zlib; + +sub ok +{ + my ($no, $ok) = @_ ; + + #++ $total ; + #++ $totalBad unless $ok ; + + print "ok $no\n" if $ok ; + print "not ok $no\n" unless $ok ; +} + +print "1..10\n"; + +$hello = <<EOM ; +hello world +this is a test +EOM + +$name = "test"; + +if (open(FH, ">$name")) { + binmode FH; + print FH $hello; + close FH; +} else { + die "$name: $!"; +} + +ok(1, $file = IO::Zlib->new()); +ok(2, $file->open($name, "rb")); +ok(3, !$file->eof()); +ok(4, $file->read($uncomp, 1024) == length($hello)); +ok(5, $file->eof()); +ok(6, $file->opened()); +ok(7, $file->close()); +ok(8, !$file->opened()); + +unlink($name); + +ok(9, $hello eq $uncomp); + +ok(10, !defined(IO::Zlib->new($name, "rb"))); + |