X-Git-Url: https://git.donarmstrong.com/?p=perltidy.git;a=blobdiff_plain;f=t%2Fsnippets24.t;fp=t%2Fsnippets24.t;h=3a783c551ca1cd119b0db3615deda94c58846bd8;hp=aa02151e4db9d301f45c0bf8e1b2346afc31c53d;hb=880633cc084e9d787eb9f760d3851c5d660db17c;hpb=57d829ae0e2c75828f8ecc9c7139579350927dbc diff --git a/t/snippets24.t b/t/snippets24.t index aa02151..3a783c5 100644 --- a/t/snippets24.t +++ b/t/snippets24.t @@ -17,6 +17,9 @@ #14 rt136417.rt136417 #15 numbers.def #16 code_skipping.def +#17 git51.def +#18 git51.git51 +#19 pretok.def # To locate test #13 you can search for its name or the string '#13' @@ -36,7 +39,29 @@ BEGIN { $rparams = { 'def' => "", 'fpva1' => "-sfp", - 'fpva2' => "-sfp -nfpva", + 'fpva2' => <<'----------', +-sfp -wls='->' -wrs='->' -nfpva +---------- + 'git51' => <<'----------', +--maximum-line-length=120 +--converge +--tabs +--entab-leading-whitespace=4 +--continuation-indentation=4 +--extended-continuation-indentation +--no-delete-old-newlines +--no-outdent-long-lines +--no-outdent-labels +--novalign +--no-logical-padding +--opening-sub-brace-on-new-line +--square-bracket-tightness=2 +--paren-tightness=2 +--brace-tightness=2 +--opening-token-right + +-sal='first any sum sum0 reduce' +---------- 'git54' => "-bbp=3 -bbpi=2 -ci=4 -lp", 'lpxl1' => "-lp", 'lpxl3' => <<'----------', @@ -96,6 +121,18 @@ Coro::AnyEvent::sleep( 3, 4 ); use Carp (); use File::Spec (); use File::Path (); +$self -> method ( 'parameter_0', 'parameter_1' ); +$self -> method_with_long_name ( 'parameter_0', 'parameter_1' ); +---------- + + 'git51' => <<'----------', +Type::Libraries->setup_class( + __PACKAGE__, + qw( + Types::Standard + Types::Common::Numeric + ), # <--- brace here +); ---------- 'git54' => <<'----------', @@ -246,6 +283,20 @@ my @vals = ( 0o12_345, # optional 'o' and 'O' added in perl v5.33.5 0O12_345, ); +---------- + + 'pretok' => <<'----------', +# test sub split_pretoken +my$s1=$^??"def":"not def"; +my$s2=$^ ?"def":"not def"; +my$s3=$^if($s2); +my$s4=$^Oeq"linux"; +my$s5=$ ^One"linux"; +my$s6=$ + ^One"linux"; +my$s7=%^O; +my$s8='hi'.'s'x10if(1); +my$s9='merci'x0.1e4.$s8; ---------- 'rt136417' => <<'----------', @@ -388,6 +439,8 @@ Coro::AnyEvent::sleep( 3, 4 ); use Carp (); use File::Spec (); use File::Path (); +$self->method( 'parameter_0', 'parameter_1' ); +$self->method_with_long_name( 'parameter_0', 'parameter_1' ); #3........... }, @@ -400,6 +453,8 @@ Coro::AnyEvent::sleep ( 3, 4 ); use Carp (); use File::Spec (); use File::Path (); +$self->method ( 'parameter_0', 'parameter_1' ); +$self->method_with_long_name ( 'parameter_0', 'parameter_1' ); #4........... }, @@ -412,6 +467,8 @@ Coro::AnyEvent::sleep ( 3, 4 ); use Carp (); use File::Spec (); use File::Path (); +$self -> method ( 'parameter_0', 'parameter_1' ); +$self -> method_with_long_name ( 'parameter_0', 'parameter_1' ); #5........... }, @@ -580,11 +637,11 @@ debug( # simple function call with code block $m->command( -label => 'Save', - -command => sub { print "DOS\n"; save_dialog($win); } ); + -command => sub { print "DOS\n"; save_dialog($win); } +); # function call, ternary in list -return - OptArgs2::Result->usage( +return OptArgs2::Result->usage( $style == OptArgs2::STYLE_FULL ? 'FullUsage' : 'NormalUsage', 'usage: ' . $usage . "\n" ); @@ -715,11 +772,11 @@ debug( # simple function call with code block $m->command( -label => 'Save', - -command => sub { print "DOS\n"; save_dialog($win); } ); + -command => sub { print "DOS\n"; save_dialog($win); } +); # function call, ternary in list -return - OptArgs2::Result->usage( +return OptArgs2::Result->usage( $style == OptArgs2::STYLE_FULL ? 'FullUsage' : 'NormalUsage', 'usage: ' . $usage . "\n" ); @@ -864,6 +921,51 @@ my $self = shift; my $cloning = shift; #16........... }, + + 'git51.def' => { + source => "git51", + params => "def", + expect => <<'#17...........', +Type::Libraries->setup_class( + __PACKAGE__, + qw( + Types::Standard + Types::Common::Numeric + ), # <--- brace here +); +#17........... + }, + + 'git51.git51' => { + source => "git51", + params => "git51", + expect => <<'#18...........', +Type::Libraries->setup_class( + __PACKAGE__, + qw( + Types::Standard + Types::Common::Numeric + ), # <--- brace here +); +#18........... + }, + + 'pretok.def' => { + source => "pretok", + params => "def", + expect => <<'#19...........', +# test sub split_pretoken +my $s1 = $^? ? "def" : "not def"; +my $s2 = $^ ? "def" : "not def"; +my $s3 = $^ if ($s2); +my $s4 = $^O eq "linux"; +my $s5 = $^O ne "linux"; +my $s6 = $^O ne "linux"; +my $s7 = %^O; +my $s8 = 'hi' . 's' x 10 if (1); +my $s9 = 'merci' x 0.1e4 . $s8; +#19........... + }, }; my $ntests = 0 + keys %{$rtests};