add and change NEWS for 2.8.0 release
[parrot.git] / t / codingstd / pccmethod_deps.t
blob3103c7af02f01448147ca65303b4a02fecf3ead3
1 #! perl
2 # Copyright (C) 2007-2008, Parrot Foundation.
3 # $Id$
5 use strict;
6 use warnings;
8 use File::Glob;
9 use File::Spec;
11 use Test::More;
13 my $pmc_dir  = File::Spec->catfile(qw( src pmc *.pmc ));
14 my @pmcs     = grep { contains_pccmethod($_) } glob($pmc_dir);
15 my $find_pmc = join( '|', map { s/\.pmc/\.dump/; quotemeta( $_ ) } @pmcs );
16 my $find_rx  = qr/^($find_pmc) : (.*)/;
18 open( my $fh, '<', 'Makefile' ) or die "Can't read Makefile: $!\n";
20 plan( tests => scalar @pmcs );
22 while (<$fh>) {
23     next unless /$find_rx/;
24     my ($file, $dependencies) = ($1, $2);
26     ok( $dependencies =~ /PCCMETHOD\.pm/,
27         "$file should mark PCCMETHOD.pm dependency in Makefile" );
30 sub contains_pccmethod {
31     my $file = shift;
32     open( my $fh, '<', $file ) or die "Can't read '$file': $!\n";
34     local $_;
35     while (<$fh>) {
36         next unless /METHOD/;
37         return 1;
38     }
40     return;
43 # Local Variables:
44 #   mode: cperl
45 #   cperl-indent-level: 4
46 #   fill-column: 100
47 # End:
48 # vim: expandtab shiftwidth=4: