| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use Test::More tests => 4; |
| 4 |
use Plack::Test; |
| 5 |
use HTTP::Request::Common; |
| 6 |
|
| 7 |
my @splat; |
| 8 |
|
| 9 |
{ |
| 10 |
package App; |
| 11 |
use Dancer2; |
| 12 |
get '/*/*/*' => sub { |
| 13 |
my $params = params(); |
| 14 |
::is_deeply( |
| 15 |
$params, |
| 16 |
{ splat => [ qw<foo bar baz> ], foo => 42 }, |
| 17 |
'Correct params', |
| 18 |
); |
| 19 |
|
| 20 |
@splat = splat; |
| 21 |
}; |
| 22 |
} |
| 23 |
|
| 24 |
my $test = Plack::Test->create( App->to_app ); |
| 25 |
my $res = $test->request( GET '/foo/bar/baz?foo=42' ); |
| 26 |
|
| 27 |
is_deeply( [@splat], [qw(foo bar baz)], 'splat behaves as expected' ); |
| 28 |
is( $res->code, 200, 'got a 200' ); |
| 29 |
is_deeply( $res->content, 3, 'got expected response' ); |
| 30 |
|