summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1999-05-08 14:16:30 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1999-05-08 14:16:30 +0000
commit4592e6caefc41a75573f112714d170071892a537 (patch)
tree175f11b85a9a6c4b3cd13613edc0b305d47b6976 /t
parent1d8d4d2a360e43d2337420c8e4a3eafc2e301cba (diff)
downloadperl-4592e6caefc41a75573f112714d170071892a537.tar.gz
Implement OPEN, EOF, SEEK, TELL, BINMODE and FILENO as TIEHANDLE methods.
Provide Tie::StdHandle Basic update of docs. p4raw-id: //depot/perl@3330
Diffstat (limited to 't')
-rwxr-xr-xt/lib/tie-stdhandle.t49
1 files changed, 49 insertions, 0 deletions
diff --git a/t/lib/tie-stdhandle.t b/t/lib/tie-stdhandle.t
new file mode 100755
index 0000000000..c74669a5b3
--- /dev/null
+++ b/t/lib/tie-stdhandle.t
@@ -0,0 +1,49 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+}
+
+use Tie::Handle;
+tie *tst,Tie::StdHandle;
+
+$f = 'tst';
+
+print "1..12\n";
+
+# my $file tests
+
+unlink("afile.new") if -f "afile";
+print "$!\nnot " unless open($f,"+>afile");
+print "ok 1\n";
+print "$!\nnot " unless binmode($f);
+print "ok 2\n";
+print "not " unless -f "afile";
+print "ok 3\n";
+print "not " unless print $f "SomeData\n";
+print "ok 4\n";
+print "not " unless tell($f) == 9;
+print "ok 5\n";
+print "not " unless printf $f "Some %d value\n",1234;
+print "ok 6\n";
+print "not " unless seek($f,0,0);
+print "ok 7\n";
+$b = <$f>;
+print "not " unless $b eq "SomeData\n";
+print "ok 8\n";
+print "not " if eof($f);
+print "ok 9\n";
+read($f,($b=''),4);
+print "'$b' not " unless $b eq 'Some';
+print "ok 10\n";
+print "not " unless getc($f) eq ' ';
+print "ok 11\n";
+$b = <$f>;
+print "not " unless eof($f);
+print "ok 12\n";
+print "not " unless close($f);
+print "ok 13\n";
+unlink("afile");
+
+