6 use Test::More 'no_plan';
8 # Fail for every PERL_ARGS_ASSERT* macro that was declared but not used.
15 unless (-d 't' && -f 'MANIFEST') {
16 # we'll assume that we are in t then.
17 # All files are interal to perl, so Unix-style is sufficiently portable.
22 my $proto = $prefix . 'proto.h';
24 open my $fh, '<', $proto or die "Can't open $proto: $!";
27 $declared{$1}++ if /^#define\s+(PERL_ARGS_ASSERT[A-Za-z_]+)\s+/;
31 cmp_ok(scalar keys %declared, '>', 0, 'Some macros were declared');
34 my $manifest = $prefix . 'MANIFEST';
35 open my $fh, '<', $manifest or die "Can't open $manifest: $!";
38 push @ARGV, $prefix . $1 if m!^((?:[^/]+/)?[^/]+\.c)\t!;
43 $used{$1}++ if /^\s+(PERL_ARGS_ASSERT_[A-Za-z_]+);$/;
48 foreach (keys %declared) {
49 $unused{$_}++ unless $used{$_};
53 fail("$_ is declared but not used") foreach sort keys %unused;
55 pass('Every PERL_ARGS_ASSERT* macro declared is used');