7 if (($Config::Config{'extensions'} !~ /\bre\b/) ){
8 print "1..0 # Skip -- Perl configured without re module\n";
15 use Test::More tests => 13;
19 $INC{ 'Term/Cap.pm' } = 1;
20 local $ENV{PERL_RE_TC};
22 is( $ENV{PERL_RE_COLORS}, "md\tme\tso\tse\tus\tue",
23 'setcolor() should provide default colors' );
24 $ENV{PERL_RE_TC} = 'su,n,ny';
26 is( $ENV{PERL_RE_COLORS}, "su\tn\tny", '... or use $ENV{PERL_RE_COLORS}' );
31 local $SIG{__WARN__} = sub {
34 #eval { re::bits(1) };
35 #like( $warn, qr/Useless use/, 'bits() should warn with no args' );
37 delete $ENV{PERL_RE_COLORS};
39 is( $ENV{PERL_RE_COLORS}, undef,
40 "... should not set regex colors given 'debug'" );
41 re::bits(0, 'debugcolor');
42 isnt( $ENV{PERL_RE_COLORS}, '',
43 "... should set regex colors given 'debugcolor'" );
44 re::bits(0, 'nosuchsubpragma');
45 like( $warn, qr/Unknown "re" subpragma/,
46 '... should warn about unknown subpragma' );
47 ok( re::bits(0, 'taint') & 0x00100000, '... should set taint bits' );
48 ok( re::bits(0, 'eval') & 0x00200000, '... should set eval bits' );
53 re->import('taint', 'eval');
54 ok( $^H & 0x00100000, 'import should set taint bits in $^H when requested' );
55 ok( $^H & 0x00200000, 'import should set eval bits in $^H when requested' );
57 re->unimport('taint');
58 ok( !( $^H & 0x00100000 ), 'unimport should clear bits in $^H when requested' );
60 ok( !( $^H & 0x00200000 ), '... and again' );
61 my $reg=qr/(foo|bar|baz|blah)/;
63 eval"use re Debug=>'ALL'";
65 eval"no re Debug=>'ALL'";
66 ok( $ok, 'No segv!' );