From 72a690bbc7a34ed334dcc8ccddc79ec7a071da21 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Fri, 31 Jan 2014 19:40:10 +0200 Subject: [PATCH] Trailing whitespace --- Changes | 1 + MANIFEST | 1 + inc/Test/Run/Builder.pm | 4 ++-- lib/Term/Shell.pm | 10 +++++----- t/style-trailing-space.t | 29 +++++++++++++++++++++++++++++ 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 t/style-trailing-space.t diff --git a/Changes b/Changes index a92ea2c..afeefce 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ 0.05 Fri 31 Jan 19:35:34 IST 2014 - Minimum version of perl (CPANTS). - Add a LICENSE file (CPANTS). + - Add t/style-trailing-space.t and remove trailing whitespace. 0.04 Mon 3 Jun 17:38:17 IDT 2013 - Add an explicit version to Term::Shell::OnScopeLeave. diff --git a/MANIFEST b/MANIFEST index 1f14c43..eb653ff 100644 --- a/MANIFEST +++ b/MANIFEST @@ -16,3 +16,4 @@ t/01require.t t/02default.t t/03catchsmry.t t/pod.t +t/style-trailing-space.t diff --git a/inc/Test/Run/Builder.pm b/inc/Test/Run/Builder.pm index 35532e6..773b47b 100644 --- a/inc/Test/Run/Builder.pm +++ b/inc/Test/Run/Builder.pm @@ -54,7 +54,7 @@ sub do_test_run_tests Test::Run::CmdLine::Iface->new( { 'test_files' => [glob("t/*.t")], - } + } # 'backend_params' => $self->_get_backend_params(), ); @@ -63,7 +63,7 @@ sub do_test_run_tests sub ACTION_tags { - return + return system(qw( ctags -f tags --recurse --totals --exclude=blib/** --exclude=t/lib/** diff --git a/lib/Term/Shell.pm b/lib/Term/Shell.pm index a430055..e52c648 100644 --- a/lib/Term/Shell.pm +++ b/lib/Term/Shell.pm @@ -54,7 +54,7 @@ sub new { $attribs->{completion_function} = $completion_handler; } elsif ($o->{API}{readline} eq 'Term::ReadLine::Perl') { - $readline::rl_completion_function = + $readline::rl_completion_function = $readline::rl_completion_function = $completion_handler; } $o->find_handlers; @@ -217,7 +217,7 @@ sub page_internal { else { $instructions = "enter for more, or q to quit"; } - + if ($lines_left > 0) { local $| = 1; my $l = "---line $current_line/$total_lines ($instructions)---"; @@ -601,14 +601,14 @@ sub line_parsed { } # We do not parse outside of strings # elsif ($c eq '\\') { -# $arg = (defined($arg) ? $arg : '') +# $arg = (defined($arg) ? $arg : '') # . $o->process_esc(substr($args,$i+1,1)); # $i++; # } elsif ($c =~ /\s/) { push @args, $arg if defined $arg; $arg = undef - } + } else { $arg .= substr($args,$i,1); } @@ -721,7 +721,7 @@ sub possible_actions { my $action = shift; my $type = shift; my $casei = $o->{API}{case_ignore} ? '(?i)' : ''; - my @keys = grep { $_ =~ /$casei^\Q$action\E/ } + my @keys = grep { $_ =~ /$casei^\Q$action\E/ } grep { exists $o->{handlers}{$_}{$type} } keys %{$o->{handlers}}; return @keys; diff --git a/t/style-trailing-space.t b/t/style-trailing-space.t new file mode 100644 index 0000000..0d1459a --- /dev/null +++ b/t/style-trailing-space.t @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +eval "use Test::TrailingSpace"; +if ($@) +{ + plan skip_all => "Test::TrailingSpace required for trailing space test."; +} +else +{ + plan tests => 1; +} + +my $finder = Test::TrailingSpace->new( + { + root => '.', + filename_regex => qr/(?:(?:\.(?:t|pm|pl|PL|yml|json|arc|vim))|README|Changes|LICENSE)\z/, + }, +); + +# TEST +$finder->no_trailing_space( + "No trailing space was found." +); +