From d26ab924bbea5dd5379307deb59c11af3692350b Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Mon, 13 Nov 2000 00:23:44 +0000 Subject: [PATCH] Couple of tests from #7660 salvaged. p4raw-id: //depot/perl@7664 --- MANIFEST | 1 - t/io/tell.t | 12 +++++++++++- t/op/tell.t | 53 ----------------------------------------------------- 3 files changed, 11 insertions(+), 55 deletions(-) delete mode 100644 t/op/tell.t diff --git a/MANIFEST b/MANIFEST index 3161168..eb1ec5c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1554,7 +1554,6 @@ t/op/subst_wamp.t See if substitution works with $& present t/op/substr.t See if substr works t/op/sysio.t See if sysread and syswrite work t/op/taint.t See if tainting works -t/op/tell.t See if tell works t/op/tie.t See if tie/untie functions work t/op/tiearray.t See if tie for arrays works t/op/tiehandle.t See if tie for handles works diff --git a/t/io/tell.t b/t/io/tell.t index b89aefb..560836d 100755 --- a/t/io/tell.t +++ b/t/io/tell.t @@ -2,7 +2,7 @@ # $RCSfile: tell.t,v $$Revision$$Date$ -print "1..21\n"; +print "1..23\n"; $TST = 'tst'; @@ -82,3 +82,13 @@ if ($. == $curline) { print "ok 20\n"; } else { print "not ok 20\n"; } tell other; if ($. == 7) { print "ok 21\n"; } else { print "not ok 21\n"; } } + +close(other); +if (tell(other) == -1) { print "ok 22\n"; } else { print "not ok 22\n"; } + +if (tell(ether) == -1) { print "ok 23\n"; } else { print "not ok 23\n"; } + +# ftell(STDIN) (or any std streams) is undefined, it can return -1 or +# something else. ftell() on pipes, fifos, and sockets is defined to +# return -1. + diff --git a/t/op/tell.t b/t/op/tell.t deleted file mode 100644 index a4500d1..0000000 --- a/t/op/tell.t +++ /dev/null @@ -1,53 +0,0 @@ -#!./perl - -BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; -} - -# NOTE: we cannot use seek() here because using that *portably* would mean -# using Fcntl and the principle is not to use any extensions in the t/op/* - -print "1..6\n"; - -{ -no warnings 'io'; -print "not " unless tell(TEST) == -1; -print "ok 1\n"; -} - -open(TEST, "TEST") || die "$0: failed to open 'TEST' for reading: $!\n"; - -print "not " unless tell(TEST) == 0; -print "ok 2\n"; - -my ($s, $read); - -$read = read(TEST, $s, 2); - -$read == 2 || warn "$0: read() returned $read, expected 2\n"; -$s eq '#!' || warn "$0: read() read '$s', expected '#!'\n"; - -print "not " unless tell(TEST) == 2; -print "ok 3\n"; - -print "not " unless tell() == 2; -print "ok 4\n"; - -my $TEST = 'TEST'; - -print "not " unless tell($TEST) == 2; -print "ok 5\n"; - -close(TEST) || warn "$0: close() failed: $!\n"; - -{ -no warnings 'io'; -print "not " unless tell(TEST) == -1; -print "ok 6\n"; -} - -# ftell(STDIN) (or any std streams) is undefined, it can return -1 or -# something else. ftell() on pipes, fifos, and sockets is defined to -# return -1. - -- 2.7.4