]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix c352
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 25 Mar 2024 22:17:51 +0000 (15:17 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 25 Mar 2024 22:17:51 +0000 (15:17 -0700)
lib/Perl/Tidy/Formatter.pm
t/snippets/c352.in [new file with mode: 0644]
t/snippets/expect/c352.def [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets29.t

index fd487e0feab8b9718b9623fed039265da59cafc1..2bc654d088d14c955982274787955b928f044232 100644 (file)
@@ -23940,6 +23940,11 @@ EOM
                   )
             );
             return if ( !$combine_ok );
+
+            # added for issue c352
+            if ($this_line_is_semicolon_terminated) {
+                $forced_breakpoint_to_go[$iend_1] = 0;
+            }
         }
         else {
             # not a special type
@@ -24173,6 +24178,11 @@ EOM
             );
 
             return if ( !$combine_ok );
+
+            # added for issue c352
+            if ($this_line_is_semicolon_terminated) {
+                $forced_breakpoint_to_go[$iend_1] = 0;
+            }
         }
 
         # handle leading keyword..
diff --git a/t/snippets/c352.in b/t/snippets/c352.in
new file mode 100644 (file)
index 0000000..47ba3a9
--- /dev/null
@@ -0,0 +1,4 @@
+                # issue c352, recombine a small terminal quote
+                $text .= filter_blocks( $code, line( substr( $source, 0, $pos[0] ), $line ) ) . ")";
+                print( ( $Pipe->ResizeBuffer($NewSize) == $NewSize ) ? "Successful" : "Unsucessful" ) . "!\n\n";
+                my $func = 'encode_utf8(' . ( !defined $str ? 'undef' : is_utf8($str) ? '$utf8_str' : '$ascii_str' ) . ')';
diff --git a/t/snippets/expect/c352.def b/t/snippets/expect/c352.def
new file mode 100644 (file)
index 0000000..28ec750
--- /dev/null
@@ -0,0 +1,11 @@
+                # issue c352, recombine a small terminal quote
+                $text .= filter_blocks( $code,
+                    line( substr( $source, 0, $pos[0] ), $line ) ) . ")";
+                print( ( $Pipe->ResizeBuffer($NewSize) == $NewSize )
+                    ? "Successful"
+                    : "Unsucessful" ) . "!\n\n";
+                my $func =
+                  'encode_utf8('
+                  . ( !defined $str ? 'undef'
+                    : is_utf8($str) ? '$utf8_str'
+                    :                 '$ascii_str' ) . ')';
index 629f7b8fd04a85a647eeac58f3232edb838cb7bb..395f7c99d1ef9e2716bbb82e77662defe44b1cef 100644 (file)
 ../snippets29.t        dia.dia2
 ../snippets29.t        dia.dia3
 ../snippets29.t        git134.def
+../snippets29.t        git135.def
+../snippets29.t        git135.git135
 ../snippets3.t ce_wn1.ce_wn
 ../snippets3.t ce_wn1.def
 ../snippets3.t colin.colin
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
-../snippets29.t        git135.def
-../snippets29.t        git135.git135
+../snippets29.t        c352.def
index 352dd8f1dc92dd878d8689f92a65e9597d6b9a04..06538f48f90f5927003252d484cda441bf93a9a3 100644 (file)
@@ -12,6 +12,7 @@
 #9 git134.def
 #10 git135.def
 #11 git135.git135
+#12 c352.def
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -54,6 +55,13 @@ BEGIN {
     ############################
     $rsources = {
 
+        'c352' => <<'----------',
+                # issue c352, recombine a small terminal quote
+                $text .= filter_blocks( $code, line( substr( $source, 0, $pos[0] ), $line ) ) . ")";
+                print( ( $Pipe->ResizeBuffer($NewSize) == $NewSize ) ? "Successful" : "Unsucessful" ) . "!\n\n";
+                my $func = 'encode_utf8(' . ( !defined $str ? 'undef' : is_utf8($str) ? '$utf8_str' : '$ascii_str' ) . ')';
+----------
+
         'dia' => <<'----------',
 return $this->{'content'}[$row][$col];
 return $this->{'content'}->[$row]->[$col];
@@ -421,6 +429,24 @@ $mask  = ~( ~$mask | $DeadBits{$word} ) if $no_fatal;
 
 #11...........
         },
+
+        'c352.def' => {
+            source => "c352",
+            params => "def",
+            expect => <<'#12...........',
+                # issue c352, recombine a small terminal quote
+                $text .= filter_blocks( $code,
+                    line( substr( $source, 0, $pos[0] ), $line ) ) . ")";
+                print( ( $Pipe->ResizeBuffer($NewSize) == $NewSize )
+                    ? "Successful"
+                    : "Unsucessful" ) . "!\n\n";
+                my $func =
+                  'encode_utf8('
+                  . ( !defined $str ? 'undef'
+                    : is_utf8($str) ? '$utf8_str'
+                    :                 '$ascii_str' ) . ')';
+#12...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};