xref: /openbsd/gnu/usr.bin/perl/t/re/reg_namedcapture.t (revision 898184e3)
1b39c5158Smillert#!./perl
2b39c5158Smillert
3b39c5158SmillertBEGIN {
4b39c5158Smillert    chdir 't' if -d 't';
5b39c5158Smillert    @INC = '../lib';
6*898184e3Ssthen    unless (defined &DynaLoader::boot_DynaLoader) {
7*898184e3Ssthen      print "1..0 # Skip: no dynamic loading on miniperl, no Tie::Hash::NamedCapture\n";
8b39c5158Smillert      exit 0;
9b39c5158Smillert    }
10b39c5158Smillert}
11b39c5158Smillert
12b39c5158Smillert# WARNING: Do not directly use any modules as part of this test code.
13b39c5158Smillert# We could get action at a distance that would invalidate the tests.
14b39c5158Smillert
15b39c5158Smillertprint "1..2\n";
16b39c5158Smillert
17b39c5158Smillert# This tests whether glob assignment fails to load the tie.
18b39c5158Smillert*X = *-;
19b39c5158Smillert'X'=~/(?<X>X)/;
20b39c5158Smillertprint eval '*X{HASH}{X} || 1' ? "" :"not ","ok ",++$test,"\n";
21b39c5158Smillert
22b39c5158Smillert# And since it's a similar case we check %! as well. Note that
23b39c5158Smillert# this can't be done until ../lib/Errno.pm is in place, as the
24b39c5158Smillert# glob hits $!, which needs that module.
25b39c5158Smillert*Y = *!;
26b39c5158Smillertprint 0<keys(%Y) ? "" :"not ","ok ",++$test,"\n";
27