#!/perl -w
BEGIN {
chdir
't'
;
require
'./test.pl'
;
}
plan(
'no_plan'
);
open
my
$fh
,
'<'
,
'../MANIFEST'
or
die
"Can't open MANIFEST: $!"
;
my
%exceptions
= (
filter_exception
=>
"require './test.pl'"
,
hints
=>
"require './test.pl'"
,
parser
=>
'use DieDieDie'
,
parser_run
=>
"require './test.pl'"
,
proto
=>
'use strict'
,
);
while
(
my
$file
= <
$fh
>) {
next
unless
$file
=~ s!^t/!!;
chomp
$file
;
$file
=~ s/\s+.*//;
next
unless
$file
=~ m!\.t$!;
local
$/;
open
my
$t
,
'<'
,
$file
or
die
"Can't open $file: $!"
;
binmode
$t
;
my
$contents
= <
$t
>;
unlike(
$contents
,
qr/use\s+Test::(?:Simple|More)/
,
"$file doesn't use Test::Simple or Test::More"
)
unless
(
$file
=~ m|porting/test_bootstrap\.t|);
next
unless
$file
=~ m!^base/! or
$file
=~ m!^comp!;
if
(
$file
=~ m!comp/(.*)\.t! &&
$exceptions
{$1}) {
my
$allowed
=
$exceptions
{$1};
$contents
=~ s/\Q
$allowed
//gs;
}
unlike(
$contents
,
qr/^\s*use\s+/
m,
"$file doesn't use use"
)
unless
$file
eq
'comp/use.t'
;
unlike(
$contents
,
qr/^\s*require\s+/
m,
"$file doesn't use require"
)
unless
$file
eq
'comp/require.t'
}
{
my
$file
=
''
;
my
$fh
;
if
(ok(
open
(
my
$fh
,
'<'
,
'test.pl'
),
"opened test.pl"
)) {
$file
=
do
{
local
$/; <
$fh
> };
$file
//=
''
;
}
else
{
diag(
"error: $!"
);
}
ok(
length
(
$file
) > 0,
"read test.pl successfully"
);
ok(
$file
!~ /\$&/,
'Nothing in test.pl mentioned $&'
);
ok(
$file
!~ /\$`/,
'Nothing in test.pl mentioned $`'
);
ok(
$file
!~ /\$
'/, '
Nothing in test.pl mentioned $\
''
);
}