]> git.donarmstrong.com Git - perltidy.git/commitdiff
added alignment test cases
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 1 Dec 2018 01:45:49 +0000 (17:45 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 1 Dec 2018 01:45:49 +0000 (17:45 -0800)
t/snippets/expect/iscl1.iscl
t/snippets/packing_list.txt
t/snippets10.t
t/snippets13.t
t/snippets4.t

index 1359563789a444be40d340b08a36097be232333d..1465612f80e694dff549763f934c3f3c712fe7f8 100644 (file)
@@ -1,4 +1,4 @@
         # -iscl will not allow alignment of hanging side comments (currently)
         $gsmatch = ( $sub >= 50 ) ? "equal" : "lequal"; # Force an equal match for
-               # dev, but be more forgiving
-               # for releases
+             # dev, but be more forgiving
+             # for releases
index 4000e93314963fcee852a5a18f57344d463211e7..6a0c1e331aea4403b459cfaf8e4cb0a3210986a4 100644 (file)
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
+../snippets13.t        align24.def
+../snippets13.t        align25.def
+../snippets13.t        align26.def
+../snippets13.t        align27.def
+../snippets14.t        else1.def
+../snippets14.t        else2.def
index f7d153a356278ebc0c5d6808cf0f2191382d5ed2..f2b4b21468d92dd8b1991cfaae7a012bb892af46 100644 (file)
@@ -541,20 +541,20 @@ b_const      ~~ a_const;
 [ keys %main:: ] ~~ \%::;
 \%::             ~~ [];
 []               ~~ \%::;
-{ "" => 1 } ~~ [undef];
-[undef] ~~ { "" => 1 };
-{ foo => 1 } ~~ qr/^(fo[ox])$/;
-qr/^(fo[ox])$/ ~~ { foo => 1 };
-+{ 0 .. 100 }  ~~ qr/[13579]$/;
-qr/[13579]$/   ~~ +{ 0 .. 100 };
+{ "" => 1 }      ~~ [undef];
+[undef]          ~~ { "" => 1 };
+{ foo => 1 }     ~~ qr/^(fo[ox])$/;
+qr/^(fo[ox])$/   ~~ { foo => 1 };
++{ 0 .. 100 }    ~~ qr/[13579]$/;
+qr/[13579]$/     ~~ +{ 0 .. 100 };
 +{ foo => 1, bar => 2 } ~~ "foo";
 "foo" ~~ +{ foo => 1, bar => 2 };
 +{ foo => 1, bar => 2 } ~~ "baz";
 "baz" ~~ +{ foo => 1, bar => 2 };
-[]    ~~ [];
-[]    ~~ [];
-[]    ~~ [1];
-[1]   ~~ [];
+[]  ~~ [];
+[]  ~~ [];
+[]  ~~ [1];
+[1] ~~ [];
 [ ["foo"], ["bar"] ] ~~ [ qr/o/, qr/a/ ];
 [ qr/o/, qr/a/ ] ~~ [ ["foo"], ["bar"] ];
 [ "foo", "bar" ] ~~ [ qr/o/, qr/a/ ];
index c9a4f57bd06206f64f9050428d65b79c0fa0cdee..eef4c949d02a33cfd0effc18c4f6a1a9a4d6f623 100644 (file)
 #13 align21.def
 #14 align22.def
 #15 align23.def
+#16 align24.def
+#17 align25.def
+#18 align26.def
+#19 align27.def
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -124,6 +128,37 @@ $signum[$signal] = $_;
 # two equality lines with same pattern on left of equals will align
 my $orig = my $format = "^<<<<< ~~\n";
 my $abc = "abc";
+----------
+
+        'align24' => <<'----------',
+# Do not align interior fat commas here; differnt container types
+my $p    = TAP::Parser::SubclassTest->new(
+    {
+        exec    => [ $cat            => $file ],
+        sources => { MySourceHandler => { accept_all => 1 } },
+    }
+);
+----------
+
+        'align25' => <<'----------',
+# do not align commas here; different container types
+is_deeply( [ $a,        $a ], [ $b,               $c ] );
+is_deeply( { foo => $a, bar => $a }, { foo => $b, bar => $c } );
+is_deeply( [ \$a,       \$a ], [ \$b,             \$c ] );
+
+----------
+
+        'align26' => <<'----------',
+#  align first of multiple equals
+$SIG{PIPE}=sub{die"writingtoaclosedpipe"};#1=
+$SIG{HUP}=$SIG{BREAK}=$SIG{INT}=$SIG{TERM};#3=
+----------
+
+        'align27' => <<'----------',
+# do not align first equals here (unmatched commas on left side of =)
+my ( $self, $name, $type ) = @_;
+my $html_toc_fh            = $self->{_html_toc_fh};
+my $html_prelim_fh            = $self->{_html_prelim_fh};
 ----------
 
         'break5' => <<'----------',
@@ -175,8 +210,8 @@ my $account   = "Insert into accountlines
             source => "align12",
             params => "def",
             expect => <<'#3...........',
-    my $type = shift || "o";
-    my $fname = ( $type eq 'oo' ? 'orte_city' : 'orte' );
+    my $type   = shift || "o";
+    my $fname  = ( $type eq 'oo' ? 'orte_city' : 'orte' );
     my $suffix = ( $coord_system eq 'standard' ? '' : '-orig' );
 #3...........
         },
@@ -322,6 +357,53 @@ my $orig = my $format = "^<<<<< ~~\n";
 my $abc  = "abc";
 #15...........
         },
+
+        'align24.def' => {
+            source => "align24",
+            params => "def",
+            expect => <<'#16...........',
+# Do not align interior fat commas here; differnt container types
+my $p = TAP::Parser::SubclassTest->new(
+    {
+        exec    => [ $cat => $file ],
+        sources => { MySourceHandler => { accept_all => 1 } },
+    }
+);
+#16...........
+        },
+
+        'align25.def' => {
+            source => "align25",
+            params => "def",
+            expect => <<'#17...........',
+# do not align commas here; different container types
+is_deeply( [ $a, $a ], [ $b, $c ] );
+is_deeply( { foo => $a, bar => $a }, { foo => $b, bar => $c } );
+is_deeply( [ \$a, \$a ], [ \$b, \$c ] );
+
+#17...........
+        },
+
+        'align26.def' => {
+            source => "align26",
+            params => "def",
+            expect => <<'#18...........',
+#  align first of multiple equals
+$SIG{PIPE} = sub { die "writingtoaclosedpipe" };      #1=
+$SIG{HUP}  = $SIG{BREAK} = $SIG{INT} = $SIG{TERM};    #3=
+#18...........
+        },
+
+        'align27.def' => {
+            source => "align27",
+            params => "def",
+            expect => <<'#19...........',
+# do not align first equals here (unmatched commas on left side of =)
+my ( $self, $name, $type ) = @_;
+my $html_toc_fh    = $self->{_html_toc_fh};
+my $html_prelim_fh = $self->{_html_prelim_fh};
+#19...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};
index 0c5905a5fd66e574a1cc68000cb31b0bc67d5365..374e4c2bcf010ffa50264d9b7a43bfb5b980fa66 100644 (file)
@@ -475,8 +475,8 @@ else                    { $editlblk = "off"; $editlblkchecked = "unchecked" }
             expect => <<'#18...........',
         # -iscl will not allow alignment of hanging side comments (currently)
         $gsmatch = ( $sub >= 50 ) ? "equal" : "lequal"; # Force an equal match for
-               # dev, but be more forgiving
-               # for releases
+             # dev, but be more forgiving
+             # for releases
 #18...........
         },