From: Michael G. Schwern Date: Sat, 27 Apr 2002 23:20:19 +0000 (-0400) Subject: Truncate the truncate tests (was Re: truncate to grow file) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=90ddc76f9d83e9e7fbcf3b00abfef011f142b34e;p=p5sagit%2Fp5-mst-13.2.git Truncate the truncate tests (was Re: truncate to grow file) Message-ID: <20020428032019.GF1821@blackrider> p4raw-id: //depot/perl@16239 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 850c887..131d477 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -5644,6 +5644,9 @@ specified length. Produces a fatal error if truncate isn't implemented on your system. Returns true if successful, the undefined value otherwise. +The behavior is undefined if LENGTH is greater than the length of the +file. + =item uc EXPR =item uc diff --git a/t/io/fs.t b/t/io/fs.t index 9f168cb..88d1973 100755 --- a/t/io/fs.t +++ b/t/io/fs.t @@ -263,7 +263,7 @@ close(IOFSCOM); SKIP: { # Check truncating a closed file. eval { truncate "Iofs.tmp", 5; }; - + skip("no truncate - $@", 10) if $@; is(-s "Iofs.tmp", 5, "truncation to five bytes"); @@ -295,7 +295,7 @@ SKIP: { if ($needs_fh_reopen) { close (FH); open (FH, ">>Iofs.tmp") or die "Can't reopen Iofs.tmp"; } - + if ($^O eq 'vos') { skip ("# TODO - hit VOS bug posix-973 - cannot resize an open file below the current file pos.", 7); } @@ -310,12 +310,6 @@ SKIP: { ok(-z "Iofs.tmp", "fh resize to zero working (filename check)"); - ok(truncate(FH, 200), "fh resize to 200"); - is(-s FH, 200, "fh resize to 200 working (FH check)"); - - ok(truncate(FH, 0), "fh resize to 0"); - ok(-z FH, "fh resize to 0 working (FH check)"); - close FH; }