]> git.donarmstrong.com Git - perltidy.git/commitdiff
add tests b1452, b1453
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 11 Mar 2023 01:57:26 +0000 (17:57 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 11 Mar 2023 01:57:26 +0000 (17:57 -0800)
dev-bin/run_convergence_tests.pl.data
dev-bin/run_convergence_tests.pl.expect
lib/Perl/Tidy/Formatter.pm

index 804e9538bdbbd0580b1a4d6e1961e5dd2071922c..91cd7a7c41467585803a7912d0a0a026eb6737ff 100644 (file)
@@ -11514,6 +11514,52 @@ my %distance_pref =
 --indent-columns=8
 --want-trailing-commas='m'
 
+==> b1453.in <==
+my $foo =decode_json ( {
+      foo => 'bar' } );
+
+my $foo
+          =decode_json ( {
+               foo => 'bar'
+               } );
+
+==> b1453.par <==
+--variable-maximum-line-length
+--weld-nested-containers
+--continuation-indentation=10
+--maximum-line-length=24
+--indent-columns=3
+--stack-opening-hash-brace
+--vertical-tightness-closing=1
+--vertical-tightness=0
+--extended-line-up-parentheses
+# These cancel each other:
+#--nowant-right-space='='
+#--space-function-paren
+
+==> b1454.in <==
+my $red_color =
+      $widget->window->get_colormap->color_alloc(
+                                                  {
+                                                    red   => 65000,
+                                                    green => 0,
+                                                    blue  => 0
+                                                  }
+      );
+
+my $red_color = $widget->window->get_colormap->color_alloc( {
+                                                         red => 65000,
+                                                         green => 0,
+                                                         blue  => 0
+} );
+
+==> b1454.par <==
+--continuation-indentation=6
+--extended-line-up-parentheses
+--maximum-line-length=66
+--variable-maximum-line-length
+--weld-nested-containers
+
 ==> b146.in <==
 # State 1
 
index 4b9839940dc5c792734e2fcbdc976dac4086cfc0..3a5ece734c9f6e734af8c0dc337ff61f46133dfb 100644 (file)
@@ -7812,6 +7812,28 @@ my %distance_pref =
         );
 
 
+==> b1453 <==
+my $foo = decode_json( {
+      foo => 'bar' } );
+
+my $foo = decode_json( {
+      foo => 'bar' } );
+
+==> b1454 <==
+my $red_color =
+      $widget->window->get_colormap->color_alloc( {
+                                                    red   => 65000,
+                                                    green => 0,
+                                                    blue  => 0
+      } );
+
+my $red_color =
+      $widget->window->get_colormap->color_alloc( {
+                                                    red   => 65000,
+                                                    green => 0,
+                                                    blue  => 0
+      } );
+
 ==> b146 <==
 # State 1
 
index b762fa327000aacccfc58096a8b1af96af17d9c9..e4d3e68d3cf08fc9a0f685c449cf7bccc1520259 100644 (file)
@@ -10626,8 +10626,16 @@ sub weld_nested_containers {
 
     # OLD: $single_line_tol added to fix cases b1180 b1181
     #       = $rOpts_continuation_indentation > $rOpts_indent_columns ? 1 : 0;
-    # NEW: $single_line_tol=0;  fixes b1212 and b1180-1181 work now
-    my $single_line_tol = 0;
+    # NEW: $single_line_tol=0  fixes b1212; and b1180-1181 work ok now
+    #                      =1  for -vmll and -lp; fixes b1452, b1453, b1454
+    # NOTE: the combination -vmll and -lp can be unstable, especially when
+    # also combined with -wn. It may eventually be necessary to turn off -vmll
+    # if -lp is set. For now, this works. The value '1' is a minimum which
+    # works but can be increased if necessary.
+    my $single_line_tol =
+      $rOpts_variable_maximum_line_length && $rOpts_line_up_parentheses
+      ? 1
+      : 0;
 
     my $multiline_tol = $single_line_tol + 1 +
       max( $rOpts_indent_columns, $rOpts_continuation_indentation );
@@ -18289,7 +18297,7 @@ EOM
         # pass even if optimization is turned off for testing.
 
         # The OPTIMIZE_OK flag should be true except for testing.
-        use constant MAX_COMPARE_RATIO => 20;
+        use constant MAX_COMPARE_RATIO => DEVEL_MODE ? 3 : 20;
         use constant OPTIMIZE_OK       => 1;
 
         my $num_pairs    = $nend - $nbeg + 1;