From 03a194e1d4fc407a3d97010ce6702d032fee17f8 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Fri, 6 Jun 2014 15:47:59 -0400 Subject: [PATCH] Quick trailing whitespace testing --- t/99-lint.t | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/t/99-lint.t b/t/99-lint.t index 423324ea8..b5d65ba71 100644 --- a/t/99-lint.t +++ b/t/99-lint.t @@ -30,6 +30,8 @@ if (! open $fh, '<', $file) { check_subroutines($file, $fh); +check_whitespace($file, $fh); + done_testing(); sub check_subroutines { @@ -147,3 +149,37 @@ sub check_subroutines { } ## end of check_for_contract +sub check_whitespace { + + ## Check various whitespace rules + ## Arguments: two + ## 1. File name + ## 2. file handle + ## Returns: undef + + my $filename = shift; + my $fh = shift; + + ## Rewind to the beginning + seek $fh, 0, 0; + + my %found; + + ## Just in case, reset the line counter + $. = 0; + + while (<$fh>) { + + if (/ +$/) { + fail "Trailing whitespace found at line $. of file $filename"; + } + } + + ## Do *not* close the file handle! + + return; + + +} ## end of check_whitespace + + -- 2.39.5