File: 048_anon_class_create_init.t

package info (click to toggle)
libclass-mop-perl 1.04-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,244 kB
  • ctags: 1,272
  • sloc: perl: 5,192; ansic: 241; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 477 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;

use Test::More;

use Class::MOP;

{
    package MyMeta;
    use base 'Class::MOP::Class';
    sub initialize {
        my $class = shift;
        my ( $package, %options ) = @_;
        ::cmp_ok( $options{foo}, 'eq', 'this',
            'option passed to initialize() on create_anon_class()' );
        return $class->SUPER::initialize( @_ );
    }

}

my $anon = MyMeta->create_anon_class( foo => 'this' );
isa_ok( $anon, 'MyMeta' );

done_testing;