nicer action sorting for Path
[catagits/Catalyst-Runtime.git] / t / path_escape_bug.t
CommitLineData
68af3866 1#!/usr/bin/env perl
2use warnings;
3use strict;
4use Test::More qw/no_plan/;
5
6{
7 package TestApp;
8 use parent qw/Catalyst/;
9 use parent qw/Catalyst::Controller/;
10 __PACKAGE__->setup();
11
12 sub thing :Path {
13 my ($self, $c, @path) = @_;
14 $c->res->body(join "/", @path);
15 }
16 sub another :Path('something') {
17 my ($self, $c) = @_;
18 $c->forward('thing');
19 }
20 sub thing_uri :Path('thing_uri') {
21 my ($self, $c, @path) = @_;
22 $c->res->body($c->uri_for(@path));
23 }
24}
25
26use_ok "Catalyst::Test", "TestApp";
27my $req_path = 'foo/bar/baz quoxx{fnord}';
28my $req = request("/$req_path");
29ok($req->is_success, 'request succeeds');
30is($req->content, $req_path, "returned path is identical to received path");
31$req = request("/something/$req_path");
32ok($req->is_success, 'request succeeds');
33is($req->content, $req_path, "returned path is identical to received path 2");
34$req = request("/thing_uri/$req_path");
35ok($req->is_success, 'request succeeds');
36is($req->content, "http://localhost/$req_path", "returned path is identical to received path 2");
37