gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog devtools/testsuite/tabs.t


From: Ann Barcomb
Subject: [Gnash-commit] gnash ChangeLog devtools/testsuite/tabs.t
Date: Thu, 29 Mar 2007 11:42:46 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Ann Barcomb <ann>       07/03/29 11:42:46

Modified files:
        .              : ChangeLog 
Added files:
        devtools/testsuite: tabs.t 

Log message:
        Added a check for hard tabs in C++ source code.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2715&r2=1.2716
http://cvs.savannah.gnu.org/viewcvs/gnash/devtools/testsuite/tabs.t?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2715
retrieving revision 1.2716
diff -u -b -r1.2715 -r1.2716
--- ChangeLog   29 Mar 2007 09:05:05 -0000      1.2715
+++ ChangeLog   29 Mar 2007 11:42:46 -0000      1.2716
@@ -1,3 +1,8 @@
+2007-03-29 Ann Barcomb <address@hidden>
+
+       * devtools/testsuite/tabs.t: added check for hard tabs in 
+         C++ source.
+
 2007-03-29 Sandro Santilli <address@hidden>
 
        * server/sprite_instance.{h,cpp} (goto_frame): push target

Index: devtools/testsuite/tabs.t
===================================================================
RCS file: devtools/testsuite/tabs.t
diff -N devtools/testsuite/tabs.t
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ devtools/testsuite/tabs.t   29 Mar 2007 11:42:46 -0000      1.1
@@ -0,0 +1,87 @@
+#! perl
+
+use strict;
+use warnings;
+
+use FindBin qw/$Bin/;
+use lib $Bin.'/../lib';
+use Test::More tests => 1;
+use Gnash::Distribution;
+use Gnash::Utils qw/clean/;
+
+my $DIST = Gnash::Distribution->new;
+
+## Jerry Gay explained that this construction was needed because Windows
+## does not get @ARGV the same way as most systems.
+my @files = @ARGV 
+    ? ( $^O eq 'MSwin32' ? <@ARGV> : @ARGV )
+    : $DIST->get_cpp_language_files();
+
+my @failures;  
+
+foreach my $path (@files) {
+    open my $fh, '<', $path
+        or die "Cannot open '$path' for reading: $!\n";
+
+    my $prefix = qq<  $path line(s):>;
+    my $message = '';
+
+    ## Read in the entire file, as some of the cleaning spans lines
+    local $/ = undef;
+    my $entire_file = clean(<$fh>);
+    my @lines = split /\n/, $entire_file;    
+
+    ## We need the array index to report the correct line number.
+    foreach my $i (0..$#lines) {
+        my $string = $lines[$i];
+
+        ## Skip unless some tabs are found.
+        next unless ($string =~ /\t/);
+        $message .= " ".($i+1);
+    }
+    push @failures => "$prefix$message\n" if ($message);
+    close $fh;
+}
+
+ok( !scalar(@failures), "tabs" )
+    or diag( "hard tabs found in ".scalar @failures." files:address@hidden" );
+
+=head1 NAME
+
+devtools/testsuite/tabs.t - checks for tabs in C++ source and headers
+
+=head1 SYNOPSIS
+
+    # test all files
+    % prove devtools/testsuite/tabs.t
+
+    # test specific files
+    % perl devtools/testsuite/tabs.t recently/modified/file
+
+=head1 DESCRIPTION
+
+This test checks for code which contains tabs.
+
+=head1 AUTHORS
+
+Ann Barcomb <address@hidden>, based upon ideas from the Parrot
+L<http://http://dev.perl.org/perl6/> test suite.
+
+=head1 COPYRIGHT
+
+Copyright (C) 2007 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+=cut




reply via email to

[Prev in Thread] Current Thread [Next in Thread]