From: Steve Hancock Date: Mon, 7 Dec 2020 00:58:39 +0000 (-0800) Subject: add test for git #47 issue X-Git-Tag: 20210111~50 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a0d211feb2a7a6e4179bc5560b7fdd24b98ae707;p=perltidy.git add test for git #47 issue --- diff --git a/t/snippets/expect/git47.def b/t/snippets/expect/git47.def new file mode 100644 index 00000000..8f511926 --- /dev/null +++ b/t/snippets/expect/git47.def @@ -0,0 +1,31 @@ +# cannot weld here +$promises[$i]->then( + sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } +); + +sub _absolutize { + [ map { _is_scoped($_) ? $_ : [ [ [ 'pc', 'scope' ] ], ' ', @$_ ] } + @{ shift() } ] +} + +$c->helpers->log->debug( + sub { + my $req = $c->req; + my $method = $req->method; + my $path = $req->url->path->to_abs_string; + $c->helpers->timing->begin('mojo.timer'); + return qq{$method "$path"}; + } +) unless $stash->{'mojo.static'}; + +# A single signature var can weld +return Mojo::Promise->resolve($query_params)->then(&_reveal_event)->then( + sub ($code) { + return $c->render( text => '', status => $code ); + } +); diff --git a/t/snippets/expect/git47.git47 b/t/snippets/expect/git47.git47 new file mode 100644 index 00000000..d6fec301 --- /dev/null +++ b/t/snippets/expect/git47.git47 @@ -0,0 +1,24 @@ +# cannot weld here +$promises[$i]->then( + sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } +); + +sub _absolutize { [map { _is_scoped($_) ? $_ : [[['pc', 'scope']], ' ', @$_] } @{shift()}] } + +$c->helpers->log->debug(sub { + my $req = $c->req; + my $method = $req->method; + my $path = $req->url->path->to_abs_string; + $c->helpers->timing->begin('mojo.timer'); + return qq{$method "$path"}; +}) unless $stash->{'mojo.static'}; + +# A single signature var can weld +return Mojo::Promise->resolve($query_params)->then(&_reveal_event)->then(sub ($code) { + return $c->render(text => '', status => $code); +}); diff --git a/t/snippets/git47.in b/t/snippets/git47.in new file mode 100644 index 00000000..23c5a358 --- /dev/null +++ b/t/snippets/git47.in @@ -0,0 +1,28 @@ +# cannot weld here +$promises[$i]->then( + sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } +); + +sub _absolutize { [ + map { _is_scoped($_) ? $_ : [ [ [ 'pc', 'scope' ] ], ' ', @$_ ] } + @{ shift() } ] } + +$c->helpers->log->debug( sub { + my $req = $c->req; + my $method = $req->method; + my $path = $req->url->path->to_abs_string; + $c->helpers->timing->begin('mojo.timer'); + return qq{$method "$path"}; +} ) unless $stash->{'mojo.static'}; + +# A single signature var can weld +return Mojo::Promise->resolve($query_params)->then(&_reveal_event)->then( + sub ($code) { + return $c->render( text => '', status => $code ); + } +); diff --git a/t/snippets/git47.par b/t/snippets/git47.par new file mode 100644 index 00000000..a8ae6593 --- /dev/null +++ b/t/snippets/git47.par @@ -0,0 +1,15 @@ +# perltidyrc from git #47 +-pbp # Start with Perl Best Practices +-w # Show all warnings +-iob # Ignore old breakpoints +-l=120 # 120 characters per line +-mbl=2 # No more than 2 blank lines +-i=2 # Indentation is 2 columns +-ci=2 # Continuation indentation is 2 columns +-vt=0 # Less vertical tightness +-pt=2 # High parenthesis tightness +-bt=2 # High brace tightness +-sbt=2 # High square bracket tightness +-wn # Weld nested containers +-isbc # Don't indent comments without leading space +-nst # Don't output to STDOUT diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index 385985a8..eb1f161d 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -445,3 +445,5 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def +../snippets23.t git47.def +../snippets23.t git47.git47 diff --git a/t/snippets23.t b/t/snippets23.t index 3b67a41f..da8b870a 100644 --- a/t/snippets23.t +++ b/t/snippets23.t @@ -17,6 +17,8 @@ #14 wnxl.wnxl3 #15 wnxl.wnxl4 #16 align34.def +#17 git47.def +#18 git47.git47 # To locate test #13 you can search for its name or the string '#13' @@ -42,7 +44,24 @@ BEGIN { # -bot is default so we test -nbot -nbot ---------- - 'def' => "", + 'def' => "", + 'git47' => <<'----------', +# perltidyrc from git #47 +-pbp # Start with Perl Best Practices +-w # Show all warnings +-iob # Ignore old breakpoints +-l=120 # 120 characters per line +-mbl=2 # No more than 2 blank lines +-i=2 # Indentation is 2 columns +-ci=2 # Continuation indentation is 2 columns +-vt=0 # Less vertical tightness +-pt=2 # High parenthesis tightness +-bt=2 # High brace tightness +-sbt=2 # High square bracket tightness +-wn # Weld nested containers +-isbc # Don't indent comments without leading space +-nst # Don't output to STDOUT +---------- 'hash_bang' => "-x", 'listop1' => <<'----------', # -bok is default so we test nbok @@ -108,6 +127,37 @@ $foo = : 1; ---------- + 'git47' => <<'----------', +# cannot weld here +$promises[$i]->then( + sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } +); + +sub _absolutize { [ + map { _is_scoped($_) ? $_ : [ [ [ 'pc', 'scope' ] ], ' ', @$_ ] } + @{ shift() } ] } + +$c->helpers->log->debug( sub { + my $req = $c->req; + my $method = $req->method; + my $path = $req->url->path->to_abs_string; + $c->helpers->timing->begin('mojo.timer'); + return qq{$method "$path"}; +} ) unless $stash->{'mojo.static'}; + +# A single signature var can weld +return Mojo::Promise->resolve($query_params)->then(&_reveal_event)->then( + sub ($code) { + return $c->render( text => '', status => $code ); + } +); +---------- + 'hash_bang' => <<'----------', @@ -501,6 +551,75 @@ elsif ( $line =~ /^LINKURL>(.*)/i ) { $linkurl = $1; } else { $body .= $line; } #16........... }, + + 'git47.def' => { + source => "git47", + params => "def", + expect => <<'#17...........', +# cannot weld here +$promises[$i]->then( + sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } +); + +sub _absolutize { + [ map { _is_scoped($_) ? $_ : [ [ [ 'pc', 'scope' ] ], ' ', @$_ ] } + @{ shift() } ] +} + +$c->helpers->log->debug( + sub { + my $req = $c->req; + my $method = $req->method; + my $path = $req->url->path->to_abs_string; + $c->helpers->timing->begin('mojo.timer'); + return qq{$method "$path"}; + } +) unless $stash->{'mojo.static'}; + +# A single signature var can weld +return Mojo::Promise->resolve($query_params)->then(&_reveal_event)->then( + sub ($code) { + return $c->render( text => '', status => $code ); + } +); +#17........... + }, + + 'git47.git47' => { + source => "git47", + params => "git47", + expect => <<'#18...........', +# cannot weld here +$promises[$i]->then( + sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } +); + +sub _absolutize { [map { _is_scoped($_) ? $_ : [[['pc', 'scope']], ' ', @$_] } @{shift()}] } + +$c->helpers->log->debug(sub { + my $req = $c->req; + my $method = $req->method; + my $path = $req->url->path->to_abs_string; + $c->helpers->timing->begin('mojo.timer'); + return qq{$method "$path"}; +}) unless $stash->{'mojo.static'}; + +# A single signature var can weld +return Mojo::Promise->resolve($query_params)->then(&_reveal_event)->then(sub ($code) { + return $c->render(text => '', status => $code); +}); +#18........... + }, }; my $ntests = 0 + keys %{$rtests};