Skip to content

Commit 5331520

Browse files
committed
rewrite Require.t to use Test::More and add no-warnings check
1 parent 382f8c3 commit 5331520

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

t/Require.t

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
#!perl -w
22
use strict;
3-
BEGIN { $ENV{'PERL_DL_NONLAZY'} = 1 }
3+
use warnings;
4+
use Test::More;
5+
BEGIN { $ENV{'PERL_DL_NONLAZY'} = 1 }
6+
7+
my @warnings;
8+
$SIG{__WARN__} = sub { push @warnings, @_ };
49

510
require Tk;
6-
# $SIG{__WARN__} = sub { die shift };
711
my ($dir) = $INC{'Tk.pm'} =~ /^(.*)\.pm$/;
812
opendir(TK,$dir) || die "Cannot opendir $dir:$!";
913
my @files = grep(/\.pm$/,readdir(TK));
1014
closedir(TK);
11-
my $file;
12-
$Test::ntest = @files;
13-
print "1..",$Test::ntest,"\n";
14-
my $count = 1;
15-
foreach $file (@files)
15+
16+
plan tests => 1 + @files;
17+
18+
for my $file (@files)
1619
{
1720
if ($file =~ /\.pm$/)
1821
{
19-
# print "Tk/$file\n";
2022
eval { require "Tk/$file" };
21-
if ($@)
22-
{
23-
warn "Tk/$file: $@";
24-
print "not ";
25-
}
26-
print "ok ",$count++,"\n";
23+
ok !$@, "Tk/$file compiled" or diag $@;
2724
}
2825
}
2926

27+
is_deeply \@warnings, [], 'no warnings';

0 commit comments

Comments
 (0)