This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Increase $Tie::Hash::VERSION to 1.05
[perl5.git] / lib / Tie / Handle / stdhandle.t
CommitLineData
4592e6ca
NIS
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
20822f61 5 @INC = '../lib';
4592e6ca
NIS
6}
7
6269bcb3 8use Tie::StdHandle;
4592e6ca
NIS
9tie *tst,Tie::StdHandle;
10
11$f = 'tst';
12
7762c374 13print "1..14\n";
4592e6ca
NIS
14
15# my $file tests
16
052b629e
GA
17unlink("afile.new") if -f "afile";
18print "$!\nnot " unless open($f,"+>afile") && open($f, "+<", "afile");
4592e6ca
NIS
19print "ok 1\n";
20print "$!\nnot " unless binmode($f);
21print "ok 2\n";
052b629e 22print "not " unless -f "afile";
4592e6ca
NIS
23print "ok 3\n";
24print "not " unless print $f "SomeData\n";
25print "ok 4\n";
26print "not " unless tell($f) == 9;
27print "ok 5\n";
28print "not " unless printf $f "Some %d value\n",1234;
29print "ok 6\n";
30print "not " unless seek($f,0,0);
31print "ok 7\n";
32$b = <$f>;
33print "not " unless $b eq "SomeData\n";
34print "ok 8\n";
35print "not " if eof($f);
36print "ok 9\n";
37read($f,($b=''),4);
38print "'$b' not " unless $b eq 'Some';
39print "ok 10\n";
40print "not " unless getc($f) eq ' ';
41print "ok 11\n";
42$b = <$f>;
43print "not " unless eof($f);
44print "ok 12\n";
7762c374
FC
45seek($f,0,0);
46read($f,($b='scrinches'),4,4); # with offset
47print "'$b' not " unless $b eq 'scriSome';
4592e6ca 48print "ok 13\n";
7762c374
FC
49print "not " unless close($f);
50print "ok 14\n";
052b629e 51unlink("afile");