7 use lib "$FindBin::Bin/lib";
14 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1;
16 # add special paths to test here
18 # all reserved in uri's
19 qw~ : / ? [ ] @ ! $ & ' ( ) * + ; = ~, ',' , '#',
22 'a'..'z','A'..'Z',0..9,qw( - . _ ~ ),
33 use Test::More tests => 6*@paths * $iters;
34 use Catalyst::Test 'TestApp';
36 if ( $ENV{CAT_BENCHMARK} ) {
38 Benchmark::timethis( $iters, \&run_tests );
41 # 11 wallclock secs (10.14 usr + 0.20 sys = 10.34 CPU) @ 15.18/s (n=157)
42 # old dispatcher (r1486):
43 # 11 wallclock secs (10.34 usr + 0.20 sys = 10.54 CPU) @ 13.76/s (n=145)
52 run_test_for($_) for @paths;
60 $path = join "/", map uri_escape($_), @$test;
61 $test = join '', @$test;
63 $path = uri_escape($test);
68 # Skip %2F, ., [, (, and ) tests on real webservers
69 # Both Apache and lighttpd don't seem to like these
70 if ( $ENV{CATALYST_SERVER} && $path =~ /(?:%2F|\.|%5B|\(|\))/ ) {
71 skip "Skipping $path tests on remote server", 6;
76 ok( $response = request("http://localhost/args/args/$path"), "Requested args for path $path");
78 is( $response->content, $test, "$test as args" );
82 ok( $response = request("http://localhost/args/params/$path"), "Requested params for path $path");
84 is( $response->content, $test, "$test as params" );
90 $path = uri_escape( $test );
93 ok( $response = request("http://localhost/chained/multi_cap/$path/baz"), "Requested capture for path $path");
95 is( $response->content, join( ', ', split( //, $test ) ) ."; ", "$test as capture" );