]> git.donarmstrong.com Git - perltidy.git/commitdiff
fixed issue git#16
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 12 Oct 2019 00:01:09 +0000 (17:01 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 12 Oct 2019 00:01:09 +0000 (17:01 -0700)
CHANGES.md
lib/Perl/Tidy/VerticalAligner.pm
t/snippets/expect/git16.def [new file with mode: 0644]
t/snippets/git16.in [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets16.t

index 90a02e4ae2a515e73ed4a0fa8332b1f269213fe9..89c48aea4f305f0cab27e7f5013c9c235d883c02 100644 (file)
@@ -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
 
index 6817cf3ee6c0f4846e314fba62eb334131a2d82d..41795d0d7a837a6aef94d711338907f363f9b467 100644 (file)
@@ -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 (file)
index 0000000..af27278
--- /dev/null
@@ -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 (file)
index 0000000..6840f39
--- /dev/null
@@ -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 );
index 26655c9293a73b3b171b34edb2108b8e7f397258..c9c265b6652e9d04c43f8ff018f471fd4c0c57b9 100644 (file)
 ../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
 ../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
index 0994156242f7886c7458bfe2a0dfbba377274a05..b5c199a7cccbcb69fb861a110702c6806b8f3788 100644 (file)
@@ -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};