- fixed issue git#16, minor vertical alignment issue.
+ - fixed issue git#10, minor conflict of -wn and -ce
+
## 2019 09 15
- fixed issue RT#130344: false warning "operator in print statement"
# Do not weld if this makes our line too long
$do_not_weld ||= $excess_length_to_K->($Kinner_opening) > 0;
+ # DO-NOT-WELD RULE 4; implemented for git#10:
+ # Do not weld an opening -ce brace if the next container is on a single
+ # line, different from the opening brace. (This is very rare). For
+ # example, given the following with -ce, we will avoid joining the {
+ # and [
+
+ # } else {
+ # [ $_, length($_) ]
+ # }
+
+ # because this would produce a terminal one-line block:
+
+ # } else { [ $_, length($_) ] }
+
+ # which may not be what is desired. But given this input:
+
+ # } else { [ $_, length($_) ] }
+
+ # then we will do the weld and retain the one-line block
+ if ( $rOpts->{'cuddled-else'} ) {
+ my $block_type = $rLL->[$Kouter_opening]->[_BLOCK_TYPE_];
+ if ( $block_type && $rcuddled_block_types->{'*'}->{$block_type} ) {
+ my $io_line = $inner_opening->[_LINE_INDEX_];
+ my $ic_line = $inner_closing->[_LINE_INDEX_];
+ my $oo_line = $outer_opening->[_LINE_INDEX_];
+ $do_not_weld ||=
+ ( $oo_line < $io_line && $ic_line == $io_line );
+ }
+ }
+
if ($do_not_weld) {
# After neglecting a pair, we start measuring from start of point io
--- /dev/null
+# perltidy -wn -ce -cbl=sort,map,grep
+@sorted =
+ map { $_->[0] }
+ sort { $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0] }
+ map { [ $_, length($_) ] } @unsorted;
--- /dev/null
+# perltidy -wn -ce -cbl=sort,map,grep
+@sorted = map {
+ $_->[0]
+} sort {
+ $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0]
+} map {
+ [ $_, length($_) ]
+} @unsorted;
--- /dev/null
+# perltidy -wn -ce -cbl=sort,map,grep
+@sorted = map {
+ $_->[0]
+} sort {
+ $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0]
+} map {
+ [ $_, length($_) ]
+} @unsorted;
--- /dev/null
+-wn -ce -cbl=sort,map,grep
../snippets15.t spp.spp0
../snippets16.t spp.spp1
../snippets16.t spp.spp2
+../snippets16.t git16.def
../snippets2.t angle.def
../snippets2.t arrows1.def
../snippets2.t arrows2.def
../snippets9.t rt98902.def
../snippets9.t rt98902.rt98902
../snippets9.t rt99961.def
-../snippets16.t git16.def
+../snippets16.t git10.def
+../snippets16.t git10.git10
#1 spp.spp1
#2 spp.spp2
#3 git16.def
+#4 git10.def
+#5 git10.git10
# To locate test #13 you can search for its name or the string '#13'
# BEGIN SECTION 1: Parameter combinations #
###########################################
$rparams = {
- 'def' => "",
- 'spp1' => "-spp=1",
- 'spp2' => "-spp=2",
+ 'def' => "",
+ 'git10' => "-wn -ce -cbl=sort,map,grep",
+ 'spp1' => "-spp=1",
+ 'spp2' => "-spp=2",
};
############################
############################
$rsources = {
+ 'git10' => <<'----------',
+# perltidy -wn -ce -cbl=sort,map,grep
+@sorted = map {
+ $_->[0]
+} sort {
+ $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0]
+} map {
+ [ $_, length($_) ]
+} @unsorted;
+----------
+
'git16' => <<'----------',
# git#16, two equality lines with fat commas on the right
my $Package = $Self->RepositoryGet( %Param, Result => 'SCALAR' );
my %Structure = $Self->PackageParse( String => $Package );
#3...........
},
+
+ 'git10.def' => {
+ source => "git10",
+ params => "def",
+ expect => <<'#4...........',
+# perltidy -wn -ce -cbl=sort,map,grep
+@sorted =
+ map { $_->[0] }
+ sort { $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0] }
+ map { [ $_, length($_) ] } @unsorted;
+#4...........
+ },
+
+ 'git10.git10' => {
+ source => "git10",
+ params => "git10",
+ expect => <<'#5...........',
+# perltidy -wn -ce -cbl=sort,map,grep
+@sorted = map {
+ $_->[0]
+} sort {
+ $a->[1] <=> $b->[1] or $a->[0] cmp $b->[0]
+} map {
+ [ $_, length($_) ]
+} @unsorted;
+#5...........
+ },
};
my $ntests = 0 + keys %{$rtests};