File: live_component_controller_action_index_or_default.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (41 lines) | stat: -rw-r--r-- 1,022 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/../lib";

our $iters;

BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }

use Test::More;
use Catalyst::Test 'TestAppIndexDefault';

plan 'skip_all' if ( $ENV{CATALYST_SERVER} );

plan tests => 6*$iters;

if ( $ENV{CAT_BENCHMARK} ) {
    require Benchmark;
    Benchmark::timethis( $iters, \&run_tests );
}
else {
    for ( 1 .. $iters ) {
        run_tests();
    }
}

sub run_tests {
    is(get('/indexchained'), 'index_chained', ':Chained overrides index');
    is(get('/indexprivate'), 'index_private', 'index : Private still works');

# test :Path overriding default
    is(get('/one_arg'), 'path_one_arg', ':Path overrides default');
    is(get('/one_arg/foo/bar'), 'default', 'default still works');

# now the same thing with a namespace, and a trailing / on the :Path
    is(get('/default/one_arg'), 'default_path_one_arg',
        ':Path overrides default');
    is(get('/default/one_arg/foo/bar'), 'default_default',
        'default still works');
}