From: Steve Hancock Date: Sat, 12 Oct 2019 00:01:09 +0000 (-0700) Subject: fixed issue git#16 X-Git-Tag: 20191203~22 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bf85c0efb8faf499992d4a0d093f03cb5201366a;p=perltidy.git fixed issue git#16 --- diff --git a/CHANGES.md b/CHANGES.md index 90a02e4a..89c48aea 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -28,6 +28,7 @@ sub usage(); # i=1 [default; follows input] sub usage (); # i=2 [space] + - fixed issue git#16, minor vertical alignment issue. ## 2019 09 15 diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 6817cf3e..41795d0d 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -1628,7 +1628,10 @@ sub salvage_equality_matches { # decision here, but for now this is not available. for ( my $j = 1 ; $j < $jmax_new - 1 ; $j++ ) { my $new_tok = $rtokens->[$j]; - my $is_good_alignment = ( $new_tok =~ /^(=|\?|if|unless|\|\||\&\&)/ ); + + # git#16: do not consider fat commas as good aligmnents here + my $is_good_alignment = + ( $new_tok =~ /^(=|\?|if|unless|\|\||\&\&)/ && $new_tok !~ /^=>/ ); return if ($is_good_alignment); } diff --git a/t/snippets/expect/git16.def b/t/snippets/expect/git16.def new file mode 100644 index 00000000..af27278c --- /dev/null +++ b/t/snippets/expect/git16.def @@ -0,0 +1,3 @@ +# git#16, two equality lines with fat commas on the right +my $Package = $Self->RepositoryGet( %Param, Result => 'SCALAR' ); +my %Structure = $Self->PackageParse( String => $Package ); diff --git a/t/snippets/git16.in b/t/snippets/git16.in new file mode 100644 index 00000000..6840f398 --- /dev/null +++ b/t/snippets/git16.in @@ -0,0 +1,3 @@ +# git#16, two equality lines with fat commas on the right +my $Package = $Self->RepositoryGet( %Param, Result => 'SCALAR' ); +my %Structure = $Self->PackageParse( String => $Package ); diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index 26655c92..c9c265b6 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -131,6 +131,13 @@ ../snippets15.t align30.def ../snippets15.t git09.def ../snippets15.t git09.git09 +../snippets15.t git14.def +../snippets15.t sal.def +../snippets15.t sal.sal +../snippets15.t spp.def +../snippets15.t spp.spp0 +../snippets16.t spp.spp1 +../snippets16.t spp.spp2 ../snippets2.t angle.def ../snippets2.t arrows1.def ../snippets2.t arrows2.def @@ -291,10 +298,4 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def -../snippets15.t git14.def -../snippets15.t sal.def -../snippets15.t sal.sal -../snippets15.t spp.def -../snippets15.t spp.spp0 -../snippets16.t spp.spp1 -../snippets16.t spp.spp2 +../snippets16.t git16.def diff --git a/t/snippets16.t b/t/snippets16.t index 09941562..b5c199a7 100644 --- a/t/snippets16.t +++ b/t/snippets16.t @@ -3,6 +3,7 @@ # Contents: #1 spp.spp1 #2 spp.spp2 +#3 git16.def # To locate test #13 you can search for its name or the string '#13' @@ -20,6 +21,7 @@ BEGIN { # BEGIN SECTION 1: Parameter combinations # ########################################### $rparams = { + 'def' => "", 'spp1' => "-spp=1", 'spp2' => "-spp=2", }; @@ -29,6 +31,12 @@ BEGIN { ############################ $rsources = { + 'git16' => <<'----------', +# git#16, two equality lines with fat commas on the right +my $Package = $Self->RepositoryGet( %Param, Result => 'SCALAR' ); +my %Structure = $Self->PackageParse( String => $Package ); +---------- + 'spp' => <<'----------', sub get_val() { } @@ -66,6 +74,16 @@ sub get_Val () { } sub Get_val () { } #2........... }, + + 'git16.def' => { + source => "git16", + params => "def", + expect => <<'#3...........', +# git#16, two equality lines with fat commas on the right +my $Package = $Self->RepositoryGet( %Param, Result => 'SCALAR' ); +my %Structure = $Self->PackageParse( String => $Package ); +#3........... + }, }; my $ntests = 0 + keys %{$rtests};