2 # Copyright (C) 2009, Parrot Foundation.
8 use lib qw( . lib ../lib ../../lib );
9 use Test::More tests => 2;
10 use Parrot::Distribution;
11 use Parrot::Test::Util::Runloop;
15 t/codingstd/make_code_coda.t - checks for editor hint coda in Make source
20 % prove t/codingstd/make_code_coda.t
23 % perl t/codingstd/make_code_coda.t config/gen/makefiles/pge.in
27 Checks that all Make language source files have the proper editor hints coda,
28 as specified in PDD07.
32 L<docs/pdds/pdd07_codingstd.pod>
43 my $DIST = Parrot::Distribution->new;
44 my @files = @ARGV ? <@ARGV> : $DIST->get_make_language_files();
46 Parrot::Test::Util::Runloop->testloop(
47 name => 'every file has a coda',
49 per_file => sub { shift =~ m{\Q$coda\E\n*\z} },
50 diag_prefix => 'No coda found'
53 Parrot::Test::Util::Runloop->testloop(
54 name => 'only one coda per file',
56 per_file => \&check_duplicates,
57 diag_prefix => 'Duplicate coda found'
60 sub check_duplicates {
63 # append to the extra_coda array if coda-like text appears more than once
65 $vim_many++ while $buf =~ m{^ [* \t]* vim[:] }gmx;
67 $emacs_many++ while $buf =~ m{^ [* \t]* Local \s variables: }gmx;
68 return ($vim_many <= 1 && $emacs_many <= 1);
73 # cperl-indent-level: 4
76 # vim: expandtab shiftwidth=4: