add and change NEWS for 2.8.0 release
[parrot.git] / t / codingstd / trailing_space.t
blobbad9e36bb21a62d7df862670857c6c68c649692b
1 #! perl
2 # Copyright (C) 2006-2009, Parrot Foundation.
3 # $Id$
5 use strict;
6 use warnings;
8 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Distribution;
10 use Test::More tests => 1;
11 use Parrot::Test::Util::Runloop;
12 use Parrot::Config qw/ %PConfig /;
13 use File::Spec;
15 =head1 NAME
17 t/codingstd/trailing_space.t - checks for superfluous trailing space or tab characters
19 =head1 SYNOPSIS
21     # test all files
22     % prove t/codingstd/trailing_space.t
24     # test specific files
25     % perl t/codingstd/trailing_space.t src/foo.c include/parrot/bar.h
27 =head1 DESCRIPTION
29 Checks that files don't have trailing space or tab characters between the
30 last nominal character on the line and the end of line character.
32 =head1 SEE ALSO
34 L<docs/pdds/pdd07_codingstd.pod>
36 =cut
38 my $DIST = Parrot::Distribution->new;
39 my @files = @ARGV ? <@ARGV> : (
40     $DIST->get_c_language_files(),
41     $DIST->get_make_language_files(),
42     $DIST->get_perl_language_files(),
43     $DIST->get_pir_language_files(),
46 # skip files listed in the __DATA__ section
47 my $build_dir = $PConfig{build_dir};
48 my %skip_files;
49 while (<DATA>) {
50     next if m{^#};
51     next if m{^\s*$};
52     chomp;
53     $_ = File::Spec->catfile($build_dir, $_);
54     $skip_files{$_}++;
57 Parrot::Test::Util::Runloop->testloop(
58     name     => 'no trailing whitespace',
59     files    => [grep {not $skip_files{$_->path}} @files],
60     per_line => sub { $_[0] !~ m{[ \t]$}m },
61     diag_prefix => 'Trailing space or tab char found'
64 # Local Variables:
65 #   mode: cperl
66 #   cperl-indent-level: 4
67 #   fill-column: 100
68 # End:
69 # vim: expandtab shiftwidth=4:
71 __DATA__
72 # generated by tools/dev/nci_thunk_gen.pir
73 src/nci/core_thunks.c
74 src/nci/extra_thunks.c
75 t/examples/pir.t
76 t/examples/tutorial.t
77 t/library/getopt_obj.t
78 t/perl/Parrot_Test.t
79 t/run/options.t