[debsums] 06/06: Test suite: factor out internal trailing line break check
Axel Beckert
abe at deuxchevaux.org
Thu Mar 26 00:53:56 UTC 2015
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to branch master
in repository debsums.
commit 349a25d79fe5c286f436135fa64a522781563280
Author: Axel Beckert <abe at deuxchevaux.org>
Date: Thu Mar 26 01:43:54 2015 +0100
Test suite: factor out internal trailing line break check
---
t/debsums.t | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/t/debsums.t b/t/debsums.t
index 4e1d599..d9ee365 100644
--- a/t/debsums.t
+++ b/t/debsums.t
@@ -86,8 +86,10 @@ done_testing();
sub sort_lines {
my $string = shift;
- return join("\n", sort split("\n", $string)).
- $string =~ m/\n\z/ ? "\n" : '';
+ return join("\n",
+ sort
+ split("\n", $string))
+ . trailing_line_break_if_present($string);
}
sub remove_failed {
@@ -95,7 +97,7 @@ sub remove_failed {
return join("\n",
grep { !/FAILED/ }
split("\n", $string))
- . ($string =~ m/\n\z/ ? "\n" : '');
+ . trailing_line_break_if_present($string);
}
sub failed_only {
@@ -103,10 +105,19 @@ sub failed_only {
return join("\n",
grep { /FAILED/ && s/\s*FAILED// }
split("\n", $string))
- . ($string =~ m/\n\z/ ? "\n" : '');
+ . trailing_line_break_if_present($string);
}
sub expected_rc {
my $exit_code = shift;
is(rc >> 8, $exit_code, "Exit code is $exit_code");
}
+
+sub trailing_line_break_if_present {
+ my $string = shift;
+ if ($string =~ m/\n\z/) {
+ return "\n";
+ } else {
+ return '';
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/debsums.git
More information about the Pkg-perl-cvs-commits
mailing list