From: Steve Hancock Date: Thu, 16 Apr 2020 17:57:05 +0000 (-0700) Subject: update test cases for recent changes X-Git-Tag: 20200619~90 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3c5ae71cb15dd2a1e2920ee24e22aca32471c654;p=perltidy.git update test cases for recent changes --- diff --git a/t/snippets/align32.in b/t/snippets/align32.in new file mode 100644 index 00000000..7fc51fe4 --- /dev/null +++ b/t/snippets/align32.in @@ -0,0 +1,4 @@ +# should not get alignment here: +my $c_sub_khwnd = WindowFromId $k_hwnd, 0x8008; # FID_CLIENT +ok $c_sub_khwnd, 'have kids client window'; +ok IsWindow($c_sub_khwnd), 'IsWindow works on the client'; diff --git a/t/snippets/expect/align32.def b/t/snippets/expect/align32.def new file mode 100644 index 00000000..7fc51fe4 --- /dev/null +++ b/t/snippets/expect/align32.def @@ -0,0 +1,4 @@ +# should not get alignment here: +my $c_sub_khwnd = WindowFromId $k_hwnd, 0x8008; # FID_CLIENT +ok $c_sub_khwnd, 'have kids client window'; +ok IsWindow($c_sub_khwnd), 'IsWindow works on the client'; diff --git a/t/snippets/expect/iscl1.iscl b/t/snippets/expect/iscl1.iscl index 1465612f..a30b11f9 100644 --- a/t/snippets/expect/iscl1.iscl +++ b/t/snippets/expect/iscl1.iscl @@ -1,4 +1,4 @@ # -iscl will not allow alignment of hanging side comments (currently) - $gsmatch = ( $sub >= 50 ) ? "equal" : "lequal"; # Force an equal match for - # dev, but be more forgiving - # for releases + $gsmatch = ( $sub >= 50 ) ? "equal" : "lequal"; # Force an equal match for + # dev, but be more forgiving + # for releases diff --git a/t/snippets/expect/ternary4.def b/t/snippets/expect/ternary4.def new file mode 100644 index 00000000..e8b4fc74 --- /dev/null +++ b/t/snippets/expect/ternary4.def @@ -0,0 +1,7 @@ +# some side comments +*{"${callpkg}::$sym"} = $type eq '&' ? \&{"${pkg}::$sym"} # + : $type eq '$' ? \${"${pkg}::$sym"} # + : $type eq '@' ? \@{"${pkg}::$sym"} + : $type eq '%' ? \%{"${pkg}::$sym"} # side comment + : $type eq '*' ? *{"${pkg}::$sym"} # + : do { require Carp; Carp::croak("Can't export symbol: $type$sym") }; diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index 8036aa8f..6d6b34fa 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -168,6 +168,8 @@ ../snippets17.t pbp6.pbp ../snippets17.t bos.bos ../snippets17.t bos.def +../snippets17.t long_line.def +../snippets17.t long_line.long_line ../snippets2.t angle.def ../snippets2.t arrows1.def ../snippets2.t arrows2.def @@ -328,5 +330,5 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def -../snippets17.t long_line.def -../snippets17.t long_line.long_line +../snippets17.t align32.def +../snippets17.t ternary4.def diff --git a/t/snippets/ternary4.in b/t/snippets/ternary4.in new file mode 100644 index 00000000..87d965a7 --- /dev/null +++ b/t/snippets/ternary4.in @@ -0,0 +1,8 @@ +# some side comments +*{"${callpkg}::$sym"} = + $type eq '&' ? \&{"${pkg}::$sym"} # + : $type eq '$' ? \${"${pkg}::$sym"} # + : $type eq '@' ? \@{"${pkg}::$sym"} + : $type eq '%' ? \%{"${pkg}::$sym"} # side comment + : $type eq '*' ? *{"${pkg}::$sym"} # + : do { require Carp; Carp::croak("Can't export symbol: $type$sym") }; diff --git a/t/snippets17.t b/t/snippets17.t index 2a18bc59..fec8deee 100644 --- a/t/snippets17.t +++ b/t/snippets17.t @@ -16,6 +16,8 @@ #13 bos.def #14 long_line.def #15 long_line.long_line +#16 align32.def +#17 ternary4.def # To locate test #13 you can search for its name or the string '#13' @@ -47,6 +49,13 @@ BEGIN { ############################ $rsources = { + 'align32' => <<'----------', +# should not get alignment here: +my $c_sub_khwnd = WindowFromId $k_hwnd, 0x8008; # FID_CLIENT +ok $c_sub_khwnd, 'have kids client window'; +ok IsWindow($c_sub_khwnd), 'IsWindow works on the client'; +---------- + 'bos' => <<'----------', $top_label->set_text( gettext("check permissions.") ) ; @@ -125,6 +134,17 @@ my $subref = sub ( $cat, $id = do { state $auto_id = 0; $auto_id++ } ) { }; ---------- + 'ternary4' => <<'----------', +# some side comments +*{"${callpkg}::$sym"} = + $type eq '&' ? \&{"${pkg}::$sym"} # + : $type eq '$' ? \${"${pkg}::$sym"} # + : $type eq '@' ? \@{"${pkg}::$sym"} + : $type eq '%' ? \%{"${pkg}::$sym"} # side comment + : $type eq '*' ? *{"${pkg}::$sym"} # + : do { require Carp; Carp::croak("Can't export symbol: $type$sym") }; +---------- + 'wn7' => <<'----------', # do not weld paren to opening one-line non-paren container $Self->_Add($SortOrderDisplay{$Field->GenerateFieldForSelectSQL()}); @@ -482,6 +502,31 @@ $body = SOAP::Data->name('~V:Fault')->attr( { 'xmlns' => $SOAP::Constants::NS_EN ); #15........... }, + + 'align32.def' => { + source => "align32", + params => "def", + expect => <<'#16...........', +# should not get alignment here: +my $c_sub_khwnd = WindowFromId $k_hwnd, 0x8008; # FID_CLIENT +ok $c_sub_khwnd, 'have kids client window'; +ok IsWindow($c_sub_khwnd), 'IsWindow works on the client'; +#16........... + }, + + 'ternary4.def' => { + source => "ternary4", + params => "def", + expect => <<'#17...........', +# some side comments +*{"${callpkg}::$sym"} = $type eq '&' ? \&{"${pkg}::$sym"} # + : $type eq '$' ? \${"${pkg}::$sym"} # + : $type eq '@' ? \@{"${pkg}::$sym"} + : $type eq '%' ? \%{"${pkg}::$sym"} # side comment + : $type eq '*' ? *{"${pkg}::$sym"} # + : do { require Carp; Carp::croak("Can't export symbol: $type$sym") }; +#17........... + }, }; my $ntests = 0 + keys %{$rtests}; diff --git a/t/snippets4.t b/t/snippets4.t index 374e4c2b..1878425c 100644 --- a/t/snippets4.t +++ b/t/snippets4.t @@ -474,9 +474,9 @@ else { $editlblk = "off"; $editlblkchecked = "unchecked" } params => "iscl", expect => <<'#18...........', # -iscl will not allow alignment of hanging side comments (currently) - $gsmatch = ( $sub >= 50 ) ? "equal" : "lequal"; # Force an equal match for - # dev, but be more forgiving - # for releases + $gsmatch = ( $sub >= 50 ) ? "equal" : "lequal"; # Force an equal match for + # dev, but be more forgiving + # for releases #18........... },