File: simple.t

package info (click to toggle)
io-stringy 2.111-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 320 kB
  • sloc: perl: 1,427; makefile: 5
file content (63 lines) | stat: -rw-r--r-- 1,168 bytes parent folder | download | duplicates (7)
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
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl -w         #-*-Perl-*-

use lib "./t", "./lib"; 
use IO::Scalar;
use IO::ScalarArray;
use IO::Lines;
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 = 6;
$T->begin($ntests);

#------------------------------

my $SH = new IO::Scalar;
print $SH "Hi there!\n";
print $SH "Tres cool, no?\n";
$T->ok_eq(${$SH->sref}, "Hi there!\nTres cool, no?\n");    

$SH->seek(0, 0);
my $line = <$SH>;
$T->ok_eq($line, "Hi there!\n");

#------------------------------

my $AH = new IO::ScalarArray;
print $AH "Hi there!\n";
print $AH "Tres cool, no?\n";
$T->ok_eq(join('', @{$AH->aref}), "Hi there!\nTres cool, no?\n");    

$AH->seek(0, 0);
$line = <$AH>;
$T->ok_eq($line, "Hi there!\n");

#------------------------------

my $LH = new IO::Lines;
print $LH "Hi there!\n";
print $LH "Tres cool, no?\n";
$T->ok_eq(join('', @{$LH->aref}), "Hi there!\nTres cool, no?\n");    

$LH->seek(0, 0);
$line = <$LH>;
$T->ok_eq($line, "Hi there!\n");



### So we know everything went well...
$T->end;