From: Jarkko Hietaniemi Date: Sun, 14 Sep 2003 07:35:28 +0000 (+0000) Subject: More dup testing. X-Git-Tag: accepted/trunk/20130322.191538~22991 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff8b5bfb112b7d58414aa2519764e2d7d7e79bf1;p=platform%2Fupstream%2Fperl.git More dup testing. p4raw-id: //depot/perl@21222 --- diff --git a/t/io/dup.t b/t/io/dup.t index 5f5653a..8f54799 100755 --- a/t/io/dup.t +++ b/t/io/dup.t @@ -2,13 +2,14 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + @INC = qw(. ../lib); + require "./test.pl"; } use Config; my $test = 1; -print "1..12\n"; +print "1..25\n"; print "ok 1\n"; open(DUPOUT,">&STDOUT"); @@ -83,3 +84,46 @@ if ($Config{useperlio}) { close(F); } +curr_test(13); + +SKIP: { + skip("need perlio", 13) unless $Config{useperlio}; + + ok(open(F, ">&", STDOUT)); + isnt(fileno(F), fileno(STDOUT)); + close F; + + ok(open(F, "<&=STDIN")); + is(fileno(F), fileno(STDIN)); + close F; + + ok(open(F, ">&=STDOUT")); + is(fileno(F), fileno(STDOUT)); + close F; + + ok(open(F, ">&=STDERR")); + is(fileno(F), fileno(STDERR)); + close F; + + open(G, ">dup$$") or die; + my $g = fileno(G); + + ok(open(F, ">&=$g")); + is(fileno(F), $g); + close F; + + ok(open(F, ">&=G")); + is(fileno(F), $g); + + print G "ggg\n"; + print F "fff\n"; + + close G; # flush first + close F; # flush second + + open(G, ", "ggg\nfff\n") } + close G; + + END { 1 while unlink "dup$$" } +}