diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2012-09-24 10:15:50 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-26 13:46:46 +0000 |
commit | 485b97be9f2f2abf5a40923b5fd85f75714a8c02 (patch) | |
tree | ca05cb0ecf3828d909a898c3e5805804a0aff5f8 /t/29_cppcomments.t | |
download | perl-dbd-sqlite-tarball-master.tar.gz |
Imported from /srv/lorry/lorry-area/perl-dbd-sqlite-tarball/DBD-SQLite-1.38_01.tar.gz.HEADDBD-SQLite-1.38_01masterbaserock/morph
Diffstat (limited to 't/29_cppcomments.t')
-rw-r--r-- | t/29_cppcomments.t | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/t/29_cppcomments.t b/t/29_cppcomments.t new file mode 100644 index 0000000..040c083 --- /dev/null +++ b/t/29_cppcomments.t @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +use strict; +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More; +use t::lib::Test; + +my @c_files = (<*.c>, <*.h>, <*.xs>); +plan tests => scalar(@c_files); + +FILE: +foreach my $file (@c_files) { + if ($file =~ /ppport.h/) { + pass("$file is not ours to be tested"); + next; + } + + open my $fh, '<', $file or die "$file: $!"; + my $line = 0; + while (<$fh>) { + $line++; + if (/^(.*)\/\//) { + my $m = $1; + if ($m !~ /\*/ && $m !~ /http:$/) { # skip the // in c++ comment in parse.c + fail("C++ comment in $file line $line"); + next FILE; + } + } + + if (/#define\s+DBD_SQLITE_CROAK_DEBUG/) { + fail("debug macro is enabled in $file line $line"); + next FILE; + } + } + pass("$file has no C++ comments"); + close $fh; +} |