X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2F00-merge-conflict-markers.t;h=86f7fa5f8cca2448a1b3fedace7a8f2dc861a410;hb=8035151e41fc2e97e8a0c32cfa0e8c252c393bf2;hp=2e3b2fd579aa627f701aab61a5335f5cec7ef56f;hpb=236747534115e35975de8d51554e6e87f4248462;p=koha.git diff --git a/t/00-merge-conflict-markers.t b/t/00-merge-conflict-markers.t index 2e3b2fd579..86f7fa5f8c 100644 --- a/t/00-merge-conflict-markers.t +++ b/t/00-merge-conflict-markers.t @@ -2,27 +2,27 @@ # # This file is part of Koha. # -# Koha 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. +# Koha 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 3 of the License, or +# (at your option) any later version. # -# Koha 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. +# Koha 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 Koha; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . -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, @@ -38,21 +38,15 @@ find({ my $fh = IO::File->new($file, 'r'); my $marker_found = 0; - my $line = 0; - while (<$fh>) { - $line++; - if (/^<<<<<>>>>>/) { - # could check for ^=====, but that's often used in text files - $marker_found = 1; - last; - } + while (my $line = <$fh>) { + # could check for ^=====, but that's often used in text files + $marker_found++ if $line =~ m|^<<<<<<|; + $marker_found++ if $line =~ m|^>>>>>>|; + last if $marker_found; } 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 ) . ' )' ) : '' ) );