xref: /openbsd-src/gnu/usr.bin/perl/dist/IO/t/io_const.t (revision 256a93a44f36679bee503f12e49566c2183f6181)
1b39c5158Smillertuse Config;
2b39c5158Smillert
3b39c5158SmillertBEGIN {
4b39c5158Smillert    if($ENV{PERL_CORE}) {
5b39c5158Smillert        if ($Config{'extensions'} !~ /\bIO\b/) {
6b39c5158Smillert            print "1..0 # Skip: IO extension not compiled\n";
7b39c5158Smillert            exit 0;
8b39c5158Smillert        }
9b39c5158Smillert    }
10b39c5158Smillert}
11b39c5158Smillert
12b39c5158Smillertuse IO::Handle;
13b39c5158Smillert
14b39c5158Smillertprint "1..6\n";
15b39c5158Smillertmy $i = 1;
16b39c5158Smillertforeach (qw(SEEK_SET SEEK_CUR SEEK_END     _IOFBF    _IOLBF    _IONBF)) {
17*256a93a4Safresh1    no strict 'refs';
18b39c5158Smillert    my $d1 = defined(&{"IO::Handle::" . $_}) ? 1 : 0;
19b39c5158Smillert    my $v1 = $d1 ? &{"IO::Handle::" . $_}() : undef;
20b39c5158Smillert    my $v2 = IO::Handle::constant($_);
21b39c5158Smillert    my $d2 = defined($v2);
22b39c5158Smillert
23b39c5158Smillert    print "not "
24b39c5158Smillert	if($d1 != $d2 || ($d1 && ($v1 != $v2)));
25b39c5158Smillert    print "ok ",$i++,"\n";
26b39c5158Smillert}
27