BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
use Test::More;
+use URI;
+use URI::QueryParam;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
ok( my $content =
get('http://localhost/' . $path),
'request ' . $path . ' ok');
+ my $exp = URI->new('http://localhost:3000' . $path);
+ my ($want) = $content =~ m{/chained/(.*)};
+ my $got = URI->new('http://localhost:3000/chained/' . $want);
# Just check that the path matches, as who the hell knows or cares
# where the app is based (live tests etc)
- ok( index($content, $path) > 1, 'uri can round trip through uri_for' )
+ is $got->path, $exp->path, "uri $path can round trip through uri_for (path)"
or diag("Expected $path, got $content");
+ is_deeply $got->query_form_hash, $exp->query_form_hash, "uri $path can round trip through uri_for (query)"
+ or diag("Expected $path, got $content");
+ }
+
+ #
+ # match_captures
+ #
+ {
+
+ ok( my $response = request('http://localhost/chained/match_captures/foo/bar'), 'match_captures: falling through' );
+ is($response->header('X-TestAppActionTestMatchCaptures'), 'fallthrough', 'match_captures: fell through');
+
+ ok($response = request('http://localhost/chained/match_captures/force/bar'), 'match_captures: *not* falling through' );
+ is($response->header('X-TestAppActionTestMatchCaptures'), 'forcing', 'match_captures: forced');
+ is($response->header('X-TestAppActionTestMatchCapturesHasRan'), 'yes', 'match_captures: actually ran');
}
}