6 use lib "$FindBin::Bin/lib";
9 use Catalyst::Test 'TestApp';
12 is get('/foo'), 'Welcome to TestApp!', 'simple root action';
15 is get('/foo/with_args/hello/cthulhu'), 'Hello, Cthulhu!', 'simple argument';
16 is get('/foo/with_args/at_end/2/3'), 6, 'two arguments at the end';
17 is get('/foo/with_args/in_the_middle/3/4/end_of_the_middle'), 24, 'two arguments in the middle';
18 is get('/foo/with_args/4/8/fhtagn/15/16/23/42'), '4, 8, 15, 16, 23, 42', 'complex arguments in both';
21 is get('/foo/under/23'), 'under 23', 'under as keyword';
24 is get('/foo/,comma/iaia'), 'iaia', 'comma separation';
27 is get('/foo/lower/down/the/stream'), 'foo/stream', 'nested under blocks';
31 local $ENV{TESTAPP_ACTIONROLE} = 1;
32 is get('/foo/with_role'), 'YES', 'fully named action role works';
35 local $ENV{TESTAPP_ACTIONROLE} = 0;
36 is get('/foo/with_role'), 'NO', 'aliased action role works';
40 is get('/foo/book/Whatever/view/xml'), 'Page 1 of "Whatever" as XML', 'action class was set';
41 is get('/foo/book/Fnord/view/html?page=7'), 'Page 7 of "Fnord" as HTML', 'action class was set';
44 is get('/foo/finals/in_front'), 'foo/in_front', 'final syntax element as declarator';
45 is get('/foo/finals/final_middle'), 'foo/final_middle', 'final syntax element in the middle';
46 is get('/foo/finals/final_at_end'), 'foo/final_at_end', 'final syntax element at the end';
49 is get('/foo/expose_not_really_here'), 23, 'private action works';
51 # specify chain target directly via action
52 is get('/foo/pointed/beaver'), 'Your beaver is pointed!', 'chain target specified via action';
54 # an action from a role
55 is get('/foo/action_from_ctrl_role'), 'foo/action_from_ctrl_role', 'action from controller role';
57 # an action body that was modified
58 is get('/foo/modifier_target'), 'foo/modifier_target modified', 'action was modified by role';
59 is get('/foo/surrounded_target'), 'foo/surrounded_target surrounded', 'action was modified with around by role';
62 is get('/foo/inline_class'), 'HELLO', 'inline classes work as expected';
65 is get('/foo/wants_integer/butdoesntgetone'), 'no integer', 'validation error causes bad request error';
67 # fix bug with capture args below under { }
68 is get('/foo/lower/down/the/param/3/road/5'), 8, 'capture args and block under work together';