Author: chromatic
Date: Tue May 15 16:23:19 2007
New Revision: 18562
Added:
trunk/t/codingstd/pccmethod_deps.t (contents, props changed)
Modified:
trunk/MANIFEST
Log:
[t] Check that PMCs which use PCCMETHODs mark that dependency (RT #41975).
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST (original)
+++ trunk/MANIFEST Tue May 15 16:23:19 2007
@@ -2713,6 +2713,7 @@
t/codingstd/fixme.t []
t/codingstd/gmt_utc.t []
t/codingstd/linelength.t []
+t/codingstd/pccmethod_deps.t []
t/codingstd/perlcritic.t []
t/codingstd/pir_code_coda.t []
t/codingstd/tabs.t []
Added: trunk/t/codingstd/pccmethod_deps.t
==============================================================================
--- (empty file)
+++ trunk/t/codingstd/pccmethod_deps.t Tue May 15 16:23:19 2007
@@ -0,0 +1,52 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+
+use strict;
+use warnings;
+
+use File::Glob;
+use File::Spec;
+
+use Test::More;
+
+my $pmc_dir = File::Spec->catfile( qw( src pmc *.pmc ) );
+my @pmcs = grep { contains_pccmethod( $_ ) } glob( $pmc_dir );
+my $find_pmc = join( '|', map { s/\.pmc/\.dump/; $_ } @pmcs );
+my $find_rx = qr/^($find_pmc) : /;
+
+open( my $fh, '<', 'Makefile' ) or die "Can't read Makefile: $!\n";
+
+plan( tests => scalar @pmcs );
+
+while (<$fh>)
+{
+ next unless /$find_rx/;
+ my ($file) = $1;
+
+ my $has_dep = 0;
+
+ while (<$fh>)
+ {
+ last unless /\S/;
+ next unless /PCCMETHOD\.pm/;
+ $has_dep = 1;
+ last;
+ }
+ ok( $has_dep, "$file should mark PCCMETHOD.pm dependency" );
+}
+
+sub contains_pccmethod
+{
+ my $file = shift;
+ open( my $fh, '<', $file ) or die "Can't read '$file': $!\n";
+
+ local $_;
+ while (<$fh>)
+ {
+ next unless /PCCMETHOD/;
+ return 1;
+ }
+
+ return;
+}