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");
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, "<dup$$") or die;
+ { local $/; is(<G>, "ggg\nfff\n") }
+ close G;
+
+ END { 1 while unlink "dup$$" }
+}