Debian lenny version packages
[pkg-perl] / deb-src / libio-stringy-perl / io-stringy-2.110 / t / simple.t
1 #!/usr/bin/perl -w         #-*-Perl-*-
2
3 use lib "./t", "./lib"; 
4 use IO::Scalar;
5 use IO::ScalarArray;
6 use IO::Lines;
7 use ExtUtils::TBone;
8 use Common;
9
10
11 #--------------------
12 #
13 # TEST...
14 #
15 #--------------------
16
17 ### Make a tester:
18 my $T = typical ExtUtils::TBone;
19 Common->test_init(TBone=>$T);
20 $T->log_warnings;
21
22 ### Set the counter:
23 my $ntests = 6;
24 $T->begin($ntests);
25
26 #------------------------------
27
28 my $SH = new IO::Scalar;
29 print $SH "Hi there!\n";
30 print $SH "Tres cool, no?\n";
31 $T->ok_eq(${$SH->sref}, "Hi there!\nTres cool, no?\n");    
32
33 $SH->seek(0, 0);
34 my $line = <$SH>;
35 $T->ok_eq($line, "Hi there!\n");
36
37 #------------------------------
38
39 my $AH = new IO::ScalarArray;
40 print $AH "Hi there!\n";
41 print $AH "Tres cool, no?\n";
42 $T->ok_eq(join('', @{$AH->aref}), "Hi there!\nTres cool, no?\n");    
43
44 $AH->seek(0, 0);
45 $line = <$AH>;
46 $T->ok_eq($line, "Hi there!\n");
47
48 #------------------------------
49
50 my $LH = new IO::Lines;
51 print $LH "Hi there!\n";
52 print $LH "Tres cool, no?\n";
53 $T->ok_eq(join('', @{$LH->aref}), "Hi there!\nTres cool, no?\n");    
54
55 $LH->seek(0, 0);
56 $line = <$LH>;
57 $T->ok_eq($line, "Hi there!\n");
58
59
60
61 ### So we know everything went well...
62 $T->end;
63