Bug 19227: Reduce the number of tests run by 00-merge-conflict-markers.t
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 31 Aug 2017 14:47:11 +0000 (11:47 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 12 Sep 2017 14:29:53 +0000 (11:29 -0300)
The number of tests on jenkins is sometimes confusing:

https://jenkins.koha-community.org/job/Koha_Master_D8/lastCompletedBuild/testReport/(root)/t_00_merge_conflict_markers_t/

shows that 00-merge-conflict-markers.t ran 10,751 tests, 124 less than
the previous run. However 124 files have not been removed from the
codebase!

I suggest to count only 1 test for all files.

Moreover files from blib and cover_db are counted, they should be
excluded.

Test plan:
  prove t/00-merge-conflict-markers.t
must return green

echo ">>>>>>>" >> mainpage.pl
and run the test again
It should now fail

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/00-merge-conflict-markers.t

index 0269328..2cbe8cf 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 
-use Test::More;
+use Test::More tests => 1;
 use File::Spec;
 use File::Find;
 use IO::File;
 
+my @failures;
 find({
     bydepth => 1,
     no_chdir => 1,
@@ -48,11 +48,8 @@ find({
             }
         }
         close $fh;
-        if ($marker_found) {
-            fail("$file contains merge conflict markers in line $line");
-        } else {
-            pass("$file has no merge conflict markers");
-        }
-    },
+        push @failures, $file if $marker_found;
+},
 }, File::Spec->curdir());
-done_testing();
+
+is( @failures, 0, 'Files should not contain merge markers' . ( @failures ? ( ' (' . join( ', ', @failures ) . ' )' ) : '' ) );