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 / tied.t
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 $name="test.gz";
15
16 print "1..11\n";
17
18 $hello = <<EOM ;
19 hello world
20 this is a test
21 EOM
22
23 ok(1, tie *OUT, "IO::Zlib", $name, "wb");
24 ok(2, printf OUT "%s - %d\n", "hello", 123);
25 ok(3, print OUT $hello);
26 ok(4, untie *OUT);
27
28 ok(5, tie *IN, "IO::Zlib", $name, "rb");
29 ok(6, !eof IN);
30 ok(7, <IN> eq "hello - 123\n");
31 ok(8, read(IN, $uncomp, 1024) == length($hello));
32 ok(9, eof IN);
33 ok(10, untie *IN);
34
35 unlink($name);
36
37 ok(11, $hello eq $uncomp);