2 # Copyright (C) 2001-2010, Parrot Foundation.
8 use lib qw( . lib ../lib ../../lib );
9 use Test::More tests => 1;
10 use Parrot::Distribution;
11 use Parrot::Test::Util::Runloop;
15 t/codingstd/c_cppcomments.t - checks for C++ style comments
20 % prove t/codingstd/c_cppcomments.t
23 % perl t/codingstd/c_cppcoments.t src/foo.t include/parrot/bar.h
27 Checks that no source file in the distribution uses C++ style comments.
31 L<docs/pdds/pdd07_codingstd.pod>
40 my $DIST = Parrot::Distribution->new();
41 @files = $DIST->get_c_language_files();
42 @files = grep { $_->name !~ /.l$/ } @files;
45 Parrot::Test::Util::Runloop->testloop(
46 name => 'no c++ comments',
48 per_file => \&check_cppcomments,
49 diag_prefix => 'C++ comments found'
52 # TT # 414 (https://trac.parrot.org/parrot/ticket/414):
53 # In the POD inside a C source code file, a hyperlink such as
54 # https://trac.parrot.org will be inaccurately reported as a C++-style
57 sub check_cppcomments {
60 (?: ' (?: \\\\ | \\' | [^'] )* ' ) # remove ' string
61 | (?: " (?: \\\\ | \\" | [^"] )* " ) # remove " string
62 | /\* .*? \*/ # remove C comment
63 | https?:\/\/ # TT # 414 quick fix
67 return $buf !~ m{ ( .*? // .* ) }x;
72 # cperl-indent-level: 4
75 # vim: expandtab shiftwidth=4: