add and change NEWS for 2.8.0 release
[parrot.git] / t / codingstd / cuddled_else.t
blobf278217a62968a4d82815eea169c04f3263fa43e
1 #! perl
2 # Copyright (C) 2006-2009, Parrot Foundation.
3 # $Id$
5 use strict;
6 use warnings;
7 use lib qw( . lib ../lib ../../lib );
8 use Test::More tests => 1;
9 use Parrot::Distribution;
10 use Parrot::Test::Util::Runloop;
12 =head1 NAME
14 t/codingstd/cuddled_else.t - checks for cuddled elses in source and headers
16 =head1 SYNOPSIS
18     # test all files
19     % prove t/codingstd/cuddled_else.t
21     # test specific files
22     % perl t/codingstd/cuddled_else.t src/foo.c include/parrot/bar.h
24 =head1 DESCRIPTION
26 Checks that files do not use cuddled else, that is an else on the same
27 line as the closing brace of the if part.
29 =head1 SEE ALSO
31 L<docs/pdds/pdd07_codingstd.pod>
33 =cut
35 my $DIST = Parrot::Distribution->new;
36 my @files = @ARGV ? <@ARGV> : (
37     $DIST->get_c_language_files(),
38     $DIST->get_perl_language_files(),
42 Parrot::Test::Util::Runloop->testloop(
43     name        => 'no cuddled elses',
44     files       => [@files],
45     per_line    => sub { $_[0] !~ /}\s*else\s*{/ },
46     diag_prefix => 'Cuddled else found'
49 # Local Variables:
50 #   mode: cperl
51 #   cperl-indent-level: 4
52 #   fill-column: 100
53 # End:
54 # vim: expandtab shiftwidth=4: