diff --git a/t/03_route_handler/15_prefix.t b/t/03_route_handler/15_prefix.t index fec2e2930..d91f69df1 100644 --- a/t/03_route_handler/15_prefix.t +++ b/t/03_route_handler/15_prefix.t @@ -1,7 +1,7 @@ use Test::More import => ['!pass']; use t::lib::TestUtils; -plan tests => 23; +plan tests => 26; use Dancer ':syntax'; use Dancer::Test; @@ -53,6 +53,14 @@ ok( 'route /:word defined' ); +ok( + get( + '/' => sub { + "char: all"; + } + ), + 'route / defined' +); ok( prefix(undef), "undef prefix" ); @@ -66,6 +74,7 @@ ok( ); my @tests = ( + { path => '/say/', expected => 'char: all' }, { path => '/say/A', expected => 'char: A' }, { path => '/say/24', expected => 'number: 24' }, { path => '/say/B', expected => 'char: B' }, diff --git a/t/17_apps/03_prefix.t b/t/17_apps/03_prefix.t index 71c6d4434..4a639e452 100644 --- a/t/17_apps/03_prefix.t +++ b/t/17_apps/03_prefix.t @@ -1,4 +1,4 @@ -use Test::More tests => 3, import => ['!pass']; +use Test::More tests => 5, import => ['!pass']; use strict; use warnings; @@ -7,6 +7,10 @@ use Dancer::Test; prefix '/foo'; +get '/' => sub { + '/foo and /foo/' +}; + get '/bar' => sub { "/foo/bar" }; @@ -17,6 +21,8 @@ get '/baz' => sub { "/baz" }; -response_content_is [GET => "/foo/bar"], "/foo/bar"; -response_doesnt_exist [GET => '/foo/baz']; -response_content_is [GET => "/baz"], "/baz"; +response_content_is [ GET => "/foo/bar" ], "/foo/bar"; +response_content_is [ GET => "/foo/" ], "/foo and /foo/"; +response_content_is [ GET => "/foo" ], "/foo and /foo/"; +response_doesnt_exist [ GET => '/foo/baz' ]; +response_content_is [ GET => "/baz" ], "/baz";