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