Add the original source packages to maemo, source lenny
[dh-make-perl] / dev / i386 / libio-stringy-perl / io-stringy-2.110 / t / two.t
1 #!/usr/bin/perl -w         #-*-Perl-*-
2
3 use lib "./t", "./lib"; 
4 use IO::Scalar;
5 use ExtUtils::TBone;
6 use Common;
7
8
9 #--------------------
10 #
11 # TEST...
12 #
13 #--------------------
14
15 ### Make a tester:
16 my $T = typical ExtUtils::TBone;
17 Common->test_init(TBone=>$T);
18 $T->log_warnings;
19
20 ### Set the counter:
21 my $ntests = (($] >= 5.004) ? 2 : 0);
22 $T->begin($ntests);
23 if ($ntests == 0) {
24     $T->end;
25     exit 0;
26 }
27
28 ### Open handles on strings:
29 my $str1 = "Tea for two";
30 my $str2 = "Me 4 U";
31 my $str3 = "hello";
32 my $S1 = IO::Scalar->new(\$str1);
33 my $S2 = IO::Scalar->new(\$str2);
34
35 ### Interleave output:
36 print $S1 ", and two ";
37 print $S2 ", and U ";
38 my $S3 = IO::Scalar->new(\$str3);
39 $S3->print(", world");
40 print $S1 "for tea";
41 print $S2 "4 me";
42
43 ### Verify:
44 $T->ok_eq($str1, 
45           "Tea for two, and two for tea",
46           "COHERENT STRING 1");
47 $T->ok_eq($str2, 
48           "Me 4 U, and U 4 me",
49           "COHERENT STRING 2");
50
51 ### So we know everything went well...
52 $T->end;
53