]> git.donarmstrong.com Git - perltidy.git/commitdiff
added new vertical alignment test cases
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 16 Nov 2018 16:49:16 +0000 (08:49 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 16 Nov 2018 16:49:16 +0000 (08:49 -0800)
t/snippets/align21.in
t/snippets/align22.in [new file with mode: 0644]
t/snippets/align23.in [new file with mode: 0644]
t/snippets/expect/align21.def
t/snippets/expect/align22.def [new file with mode: 0644]
t/snippets/expect/align23.def [new file with mode: 0644]
t/snippets/expect/carat.def
t/snippets/packing_list.txt
t/snippets13.t
t/snippets2.t

index 9a6a33da554d4406c10d2c4c2101725b15752100..7deed5d767e7b9ce14299a7d33d8aed6913cd8c1 100644 (file)
@@ -1,3 +1,3 @@
-# do not align these two (large gap)
+# two lines with large gap
 local (@pieces)            = split( /\./, $filename, 2 );
 local ($just_dir_and_base) = $pieces[0];
diff --git a/t/snippets/align22.in b/t/snippets/align22.in
new file mode 100644 (file)
index 0000000..4a6346c
--- /dev/null
@@ -0,0 +1,3 @@
+# two equality lines with different patterns to left of equals do not align
+$signame{$_} = ++$signal;
+$signum[$signal] = $_;
diff --git a/t/snippets/align23.in b/t/snippets/align23.in
new file mode 100644 (file)
index 0000000..c56d0a8
--- /dev/null
@@ -0,0 +1,3 @@
+# two equality lines with same pattern on left of equals will align
+my $orig = my $format = "^<<<<< ~~\n";
+my $abc = "abc";
index c817a9d9e96e8bddd310a5be390e2b345033147d..7deed5d767e7b9ce14299a7d33d8aed6913cd8c1 100644 (file)
@@ -1,3 +1,3 @@
-# do not align these two (large gap)
-local (@pieces) = split( /\./, $filename, 2 );
+# two lines with large gap
+local (@pieces)            = split( /\./, $filename, 2 );
 local ($just_dir_and_base) = $pieces[0];
diff --git a/t/snippets/expect/align22.def b/t/snippets/expect/align22.def
new file mode 100644 (file)
index 0000000..4a6346c
--- /dev/null
@@ -0,0 +1,3 @@
+# two equality lines with different patterns to left of equals do not align
+$signame{$_} = ++$signal;
+$signum[$signal] = $_;
diff --git a/t/snippets/expect/align23.def b/t/snippets/expect/align23.def
new file mode 100644 (file)
index 0000000..1286193
--- /dev/null
@@ -0,0 +1,3 @@
+# two equality lines with same pattern on left of equals will align
+my $orig = my $format = "^<<<<< ~~\n";
+my $abc  = "abc";
index 285c4da8b5e3d817bf2a1e11621f3f11aa65e237..9d02df1e1292fd2aeba39b86a9ced75fe3b7634f 100644 (file)
@@ -1,4 +1,4 @@
 my $a = ${^WARNING_BITS};
 @{^HOWDY_PARDNER} = ( 101, 102 );
-${^W} = 1;
+${^W}             = 1;
 $bb[$^]] = "bubba";
index cabeeda1f135e75b9760adb5e700d0d95764a576..75ab8b24646f4050ba0384714f3f92517583b41c 100644 (file)
@@ -91,6 +91,7 @@
 ../snippets13.t        break5.def
 ../snippets13.t        align19.def
 ../snippets13.t        align20.def
+../snippets13.t        align21.def
 ../snippets2.t angle.def
 ../snippets2.t arrows1.def
 ../snippets2.t arrows2.def
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
-../snippets13.t        align21.def
+../snippets13.t        align22.def
+../snippets13.t        align23.def
index 3b30c65b383e20f98518ddc3ebccdd9649b53581..b731cdde780128e4f80237d7108b6946aeebe7b9 100644 (file)
@@ -14,6 +14,8 @@
 #11 align19.def
 #12 align20.def
 #13 align21.def
+#14 align22.def
+#15 align23.def
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -109,9 +111,21 @@ $t = 1000000;
 ----------
 
         'align21' => <<'----------',
-# do not align these two (large gap)
+# two lines with large gap
 local (@pieces)            = split( /\./, $filename, 2 );
 local ($just_dir_and_base) = $pieces[0];
+----------
+
+        'align22' => <<'----------',
+# two equality lines with different patterns to left of equals do not align
+$signame{$_} = ++$signal;
+$signum[$signal] = $_;
+----------
+
+        'align23' => <<'----------',
+# two equality lines with same pattern on left of equals will align
+my $orig = my $format = "^<<<<< ~~\n";
+my $abc = "abc";
 ----------
 
         'break5' => <<'----------',
@@ -280,11 +294,31 @@ $t = 1000000;
             source => "align21",
             params => "def",
             expect => <<'#13...........',
-# do not align these two (large gap)
-local (@pieces) = split( /\./, $filename, 2 );
+# two lines with large gap
+local (@pieces)            = split( /\./, $filename, 2 );
 local ($just_dir_and_base) = $pieces[0];
 #13...........
         },
+
+        'align22.def' => {
+            source => "align22",
+            params => "def",
+            expect => <<'#14...........',
+# two equality lines with different patterns to left of equals do not align
+$signame{$_} = ++$signal;
+$signum[$signal] = $_;
+#14...........
+        },
+
+        'align23.def' => {
+            source => "align23",
+            params => "def",
+            expect => <<'#15...........',
+# two equality lines with same pattern on left of equals will align
+my $orig = my $format = "^<<<<< ~~\n";
+my $abc  = "abc";
+#15...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};
index b8bd7ca464df6bdaeb9519ef9cbfabe441e34375..03a62595fc7657a726ff0b49b02075d3a371da94 100644 (file)
@@ -435,7 +435,7 @@ my @list = ( 1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, 6, 4, 1, );
             expect => <<'#18...........',
 my $a = ${^WARNING_BITS};
 @{^HOWDY_PARDNER} = ( 101, 102 );
-${^W} = 1;
+${^W}             = 1;
 $bb[$^]] = "bubba";
 #18...........
         },