]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix c314, c400
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 29 Sep 2024 22:35:43 +0000 (15:35 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 29 Sep 2024 22:35:43 +0000 (15:35 -0700)
dev-bin/run_convergence_tests.pl.data
dev-bin/run_convergence_tests.pl.expect
lib/Perl/Tidy/Formatter.pm

index b51503147a2c7581faafab5242d7521cc2d3044a..ab362386e95351f832b8888f230903e48d764671 100644 (file)
@@ -18882,3 +18882,31 @@ my ( $v1, $v2, $v3, $v4 );
 --keyword-group-blanks-after=2
 --keyword-group-blanks-before=0
 --keyword-group-blanks-size='1.8'
+
+==> c314.in <==
+  my $map =
+          {
+    dtend =>
+            {                                                                 # 4.8.2.2
+            },
+            } ;
+
+==> c314.par <==
+--noadd-whitespace
+--indent-columns=0
+--line-up-parentheses
+--maximum-line-length=39
+--continuation-indentation=4
+
+==> c400.in <==
+Readonly::Array my @PATTERNS => (  # requires this side comment
+   ['A-Z','a-z','0-9','_']       => ['\\w', '\\W'],
+   ['A-Z','a-z']                 => ['[[:alpha:]]','[[:^alpha:]]'],
+);
+
+==> c400.par <==
+--indent-columns=0
+--continuation-indentation=3
+--extended-line-up-parentheses
+--maximum-line-length=12
+--variable-maximum-line-length
index e305c91ddbfd541f8960e50aad783e63164b5486..5f1d02b7c4f52b11716ca978651ae428cb26dcf0 100644 (file)
@@ -11729,3 +11729,32 @@ my $Quux = bless \$v4, 'Quux';
 my $v1;
 my ( $v1, $v2, $v3, $v4 );
 
+
+==> c314 <==
+my $map ={
+dtend =>
+    {                                                                 # 4.8.2.2
+    },
+} ;
+
+==> c400 <==
+Readonly::Array
+   my @PATTERNS
+   => ( # requires this side comment
+[
+  'A-Z',
+  'a-z',
+  '0-9',
+  '_'
+] => [
+      '\\w',
+      '\\W'
+],
+[
+  'A-Z',
+  'a-z'
+] => [
+'[[:alpha:]]',
+'[[:^alpha:]]'
+],
+   );
index 7a06a0f19cf483da19350dc06ceae5840d212ba3..dc5bfedb82c59375eb99e8a7673f9236aa37ea76 100644 (file)
@@ -34232,9 +34232,19 @@ EOM
                 # comment we don't know what the space to the actual
                 # next code token will be.  We will allow a space for
                 # sub correct_lp to move it in if necessary.
-                if (   $type eq '#'
+                # NOTE for c314, c400: this fix is not really necessary,
+                # and it caused a DEVEL_MODE fault when -i=0.
+                # It could be completely removed, but this would change
+                # existing formatting in a few cases. So for now, the fix
+                # is to only skip this if -i=0.
+                if (
+                       $type eq '#'
                     && $max_index_to_go > 0
-                    && $align_seqno )
+                    && $align_seqno
+
+                    # fix for c314, c400 (see above note)
+                    && $rOpts_indent_columns > 0
+                  )
                 {
                     $available_spaces += 1;
                 }