File: ComponentMeta.pm

package info (click to toggle)
libmason-perl 2.24-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 748 kB
  • sloc: perl: 4,882; makefile: 7
file content (27 lines) | stat: -rw-r--r-- 1,070 bytes parent folder | download | duplicates (3)
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
package Mason::t::ComponentMeta;
$Mason::t::ComponentMeta::VERSION = '2.24';
use Test::Class::Most parent => 'Mason::Test::Class';

sub test_cmeta : Tests {
    my $self = shift;
    $self->run_test_in_comp(
        path => '/component/meta.mc',
        args => { foo => 5, bar => [ 'baz', 7 ] },
        test => sub {
            my $comp        = shift;
            my $source_file = $self->comp_root . '/component/meta.mc';
            foreach my $cmeta ( $comp->cmeta, ref($comp)->cmeta ) {
                is( $cmeta->path,         '/component/meta.mc', 'path' );
                is( $cmeta->dir_path,     '/component',         'dir_path' );
                is( $cmeta->is_top_level, 1,                    'is_top_level' );
                is( $cmeta->source_file,  $source_file,         'source_file' );
                like( $cmeta->object_file, qr|meta\.mc\.mobj|, 'object_file' );
            }
            my $args = $comp->args;
            delete( $args->{_test} );
            cmp_deeply( $args, { foo => 5, bar => [ 'baz', 7 ] } );
        },
    );
}

1;