This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make the test more portable.
[perl5.git] / t / lib / io_const.t
1
2 BEGIN {
3     unless(grep /blib/, @INC) {
4         chdir 't' if -d 't';
5         unshift @INC, '../lib' if -d '../lib';
6     }
7 }
8
9 use Config;
10
11 BEGIN {
12     if(-d "lib" && -f "TEST") {
13         if ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS') {
14             print "1..0\n";
15             exit 0;
16         }
17     }
18 }
19
20 use IO::Handle;
21
22 print "1..6\n";
23 my $i = 1;
24 foreach (qw(SEEK_SET SEEK_CUR SEEK_END     _IOFBF    _IOLBF    _IONBF)) {
25     my $d1 = defined(&{"IO::Handle::" . $_}) ? 1 : 0;
26     my $v1 = $d1 ? &{"IO::Handle::" . $_}() : undef;
27     my $v2 = IO::Handle::constant($_);
28     my $d2 = defined($v2);
29
30     print "not "
31         if($d1 != $d2 || ($d1 && ($v1 != $v2)));
32     print "ok ",$i++,"\n";
33 }