1N/A#!./perl
1N/A
1N/ABEGIN {
1N/A chdir 't' if -d 't';
1N/A @INC = '../lib';
1N/A}
1N/A
1N/Ause strict;
1N/A
1N/Ause Test::More tests => 13;
1N/Arequire_ok( 're' );
1N/A
1N/A# setcolor
1N/A$INC{ 'Term/Cap.pm' } = 1;
1N/Alocal $ENV{PERL_RE_TC};
1N/Are::setcolor();
1N/Ais( $ENV{PERL_RE_COLORS}, "md\tme\tso\tse\tus\tue",
1N/A 'setcolor() should provide default colors' );
1N/A$ENV{PERL_RE_TC} = 'su,n,ny';
1N/Are::setcolor();
1N/Ais( $ENV{PERL_RE_COLORS}, "su\tn\tny", '... or use $ENV{PERL_RE_COLORS}' );
1N/A
1N/A# bits
1N/A# get on
1N/Amy $warn;
1N/Alocal $SIG{__WARN__} = sub {
1N/A $warn = shift;
1N/A};
1N/Aeval { re::bits(1) };
1N/Alike( $warn, qr/Useless use/, 'bits() should warn with no args' );
1N/A
1N/Adelete $ENV{PERL_RE_COLORS};
1N/Are::bits(0, 'debug');
1N/Ais( $ENV{PERL_RE_COLORS}, undef,
1N/A "... should not set regex colors given 'debug'" );
1N/Are::bits(0, 'debugcolor');
1N/Aisnt( $ENV{PERL_RE_COLORS}, '',
1N/A "... should set regex colors given 'debugcolor'" );
1N/Are::bits(0, 'nosuchsubpragma');
1N/Alike( $warn, qr/Unknown "re" subpragma/,
1N/A '... should warn about unknown subpragma' );
1N/Aok( re::bits(0, 'taint') & 0x00100000, '... should set taint bits' );
1N/Aok( re::bits(0, 'eval') & 0x00200000, '... should set eval bits' );
1N/A
1N/Alocal $^H;
1N/A
1N/A# import
1N/Are->import('taint', 'eval');
1N/Aok( $^H & 0x00100000, 'import should set taint bits in $^H when requested' );
1N/Aok( $^H & 0x00200000, 'import should set eval bits in $^H when requested' );
1N/A
1N/Are->unimport('taint');
1N/Aok( !( $^H & 0x00100000 ), 'unimport should clear bits in $^H when requested' );
1N/Are->unimport('eval');
1N/Aok( !( $^H & 0x00200000 ), '... and again' );
1N/A
1N/Apackage Term::Cap;
1N/A
1N/Asub Tgetent {
1N/A bless({}, $_[0]);
1N/A}
1N/A
1N/Asub Tputs {
1N/A return $_[1];
1N/A}