]> git.donarmstrong.com Git - perltidy.git/blobdiff - t/snippets13.t
New upstream version 20200110
[perltidy.git] / t / snippets13.t
index eef4c949d02a33cfd0effc18c4f6a1a9a4d6f623..8d7bccdc4523e92a5a12cbb35a7cdfc5f31e4367 100644 (file)
@@ -116,6 +116,14 @@ $t = 1000000;
 # two lines with large gap but same lhs pattern so align equals
 local (@pieces)            = split( /\./, $filename, 2 );
 local ($just_dir_and_base) = $pieces[0];
+
+# two lines with 3 alignment tokens
+$expect = "1$expect" if $expect =~ /^e/i;
+$p = "1$p" if defined $p and $p =~ /^e/i;
+
+# two lines where alignment causes a large gap
+is( eval { sysopen( my $ro, $foo, &O_RDONLY | $TAINT0 ) }, undef );
+is( $@, '' );
 ----------
 
         'align22' => <<'----------',
@@ -150,8 +158,9 @@ 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=
+$SIG{PIPE}=sub{die"writingtoaclosedpipe"};
+$SIG{BREAK}=$SIG{INT}=$SIG{TERM};
+$SIG{HUP}=\&some_handler;
 ----------
 
         'align27' => <<'----------',
@@ -335,6 +344,14 @@ $t = 1000000;
 # two lines with large gap but same lhs pattern so align equals
 local (@pieces)            = split( /\./, $filename, 2 );
 local ($just_dir_and_base) = $pieces[0];
+
+# two lines with 3 alignment tokens
+$expect = "1$expect" if $expect           =~ /^e/i;
+$p      = "1$p"      if defined $p and $p =~ /^e/i;
+
+# two lines where alignment causes a large gap
+is( eval { sysopen( my $ro, $foo, &O_RDONLY | $TAINT0 ) }, undef );
+is( $@,                                                    '' );
 #13...........
         },
 
@@ -389,8 +406,9 @@ is_deeply( [ \$a, \$a ], [ \$b, \$c ] );
             params => "def",
             expect => <<'#18...........',
 #  align first of multiple equals
-$SIG{PIPE} = sub { die "writingtoaclosedpipe" };      #1=
-$SIG{HUP}  = $SIG{BREAK} = $SIG{INT} = $SIG{TERM};    #3=
+$SIG{PIPE}  = sub { die "writingtoaclosedpipe" };
+$SIG{BREAK} = $SIG{INT} = $SIG{TERM};
+$SIG{HUP}   = \&some_handler;
 #18...........
         },