]> xenbits.xensource.com Git - people/dariof/xen-tools.git/commitdiff
Use Test::NoTabs in t/no-tabs.t
authorAxel Beckert <abe@deuxchevaux.org>
Tue, 5 Mar 2013 22:07:04 +0000 (23:07 +0100)
committerAxel Beckert <abe@deuxchevaux.org>
Tue, 5 Mar 2013 22:07:04 +0000 (23:07 +0100)
debian/changelog
debian/control
t/no-tabs.t

index bb7db7b4176c58cb422fd756024b21ffad9f315d..f85df2383086c0639fc0a2388645beebc8d1dbd5 100644 (file)
@@ -38,6 +38,7 @@ xen-tools (4.4~dev-1) UNRELEASED; urgency=low
     - Fix filesystem tools installation in 91-install-fs-tools (which was
       broken since 4.3~rc1-1) by merging 91-install-fs-tools back into
       90-make-fstab. Also supports RPM-based distributions now.
+    - Uses Test::NoTabs; add according build-dependency.
   * Add debian/gbp.conf to be able to to build xen-tools with
     git-buildpackage.
   * Clean up debian/rules:
index 7c2f1ce81a74226e99eceef35a7c2a3e19408b0e..8b8e9a1b1991df2863f3df6ad86e5801a65f2315 100644 (file)
@@ -8,6 +8,7 @@ Build-Depends: debhelper (>= 7.0.0),
                libfile-slurp-perl,
                libfile-which-perl,
                libmoose-perl,
+               libtest-notabs-perl,
                libtest-pod-coverage-perl,
                libtest-pod-perl,
                libtext-template-perl
index 4511e35e2a36462e2889884b0d639278f692ee5c..d5efbe48048033691fc739bb76d723bebc1bf1b9 100755 (executable)
@@ -9,8 +9,10 @@
 
 use strict;
 use File::Find;
-use Test::More;
+use Test::NoTabs;
 
+# Check all Perl files
+all_perl_files_ok();
 
 #
 #  Find all the files beneath the current directory,
@@ -18,8 +20,6 @@ use Test::More;
 #
 find( { wanted => \&checkFile, no_chdir => 1 }, '.' );
 
-done_testing();
-
 #
 #  Check a file.
 #
@@ -62,50 +62,17 @@ sub checkFile
              ( $line =~ /\/bin\/bash/ ) )
         {
             $isShell = 1;
+            last;
         }
         if ( $line =~ /\/usr\/bin\/perl/ )
         {
-            $isPerl = 1;
+            last;
         }
     }
     close( INPUT );
 
     #
-    #  Return if it wasn't a perl file.
+    #  Run check if it is a shell file.
     #
-    if ( $isShell || $isPerl )
-    {
-        #
-        #  Count TAB characters
-        #
-        my $count = countTabCharacters( $file );
-
-        is( $count, 0, "Script has no tab characters: $file" );
-    }
-}
-
-
-=head2 countTabCharacters
-
-=cut
-
-sub countTabCharacters
-{
-    my ( $file ) = (@_);
-
-    my $count = 0;
-
-    open( FILE, "<", $file )
-      or die "Cannot open $file - $!";
-    foreach my $line ( <FILE> )
-    {
-        while( $line =~ /(.*)\t(.*)/ )
-        {
-            $count += 1;
-            $line = $1 . $2;
-        }
-    }
-    close( FILE );
-
-    return( $count );
+    notabs_ok( $file ) if $isShell;
 }