Group
Extension

Matches 20

Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/016_class_errors_and_edge_cases.t ( view source; MetaCPAN )
est::Fatal;

use Class::MOP;

{
    isnt( exception {
        Class::MOP::Class->initialize();
    }, undef, '... initialize requires a name parameter' );

    isnt( exception {
        Class::MOP::Cl
lid parameter' );

    isnt( exception {
        Class::MOP::Class->initialize(bless {} => 'Foo');
    }, undef, '... initialize requires an unblessed parameter' );
}

{
    isnt( exception {
        


    isnt( exception {
        Class::MOP::Class->_construct_class_instance(':package' => undef);
    }, undef, '... _construct_class_instance requires a defined :package parameter' );

    isnt( exc
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/070_immutable_metaclass.t ( view source; MetaCPAN )
;

    isnt( exception { $meta->add_method() }, undef, '... exception thrown as expected' );
    isnt( exception { $meta->alias_method() }, undef, '... exception thrown as expected' );
    isnt( excep
   isnt( exception { $meta->add_attribute() }, undef, '... exception thrown as expected' );
    isnt( exception { $meta->remove_attribute() }, undef, '... exception thrown as expected' );

    isnt( e
xception { $meta->add_package_symbol() }, undef, '... exception thrown as expected' );
    isnt( exception { $meta->remove_package_symbol() }, undef, '... exception thrown as expected' );

    is( exc
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/021_attribute_errors_and_edge_cases.t ( view source; MetaCPAN )
e static

{
    isnt( exception {
        Class::MOP::Attribute->new('$test' => (
            default => qr/hello (.*)/
        ));
    }, undef, '... no refs for defaults' );

    isnt( exception {
 
or defaults' );

    isnt( exception {
        Class::MOP::Attribute->new('$test' => (
            default => {}
        ));
    }, undef, '... no refs for defaults' );


    isnt( exception {
       
ts' );

    isnt( exception {
        Class::MOP::Attribute->new('$test' => (
            default => bless {} => 'Foo'
        ));
    }, undef, '... no refs for defaults' );

}

{
    isnt( exception
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/073_make_mutable.t ( view source; MetaCPAN )
tch');
    is( exception { $meta->remove_package_symbol('$ref') }, undef, '... removed it' );
    isnt($meta->get_package_symbol('$ref'), $reef,    '... values match');

    ok( my @supers = $meta->su
, '... changed Baz to be immutable' );

    isnt( exception { $meta->add_method('xyz', sub{'xxx'})  }, undef, '... exception thrown as expected' );

    isnt( exception {
      $meta->add_attribute('f
ption thrown as expected' );
    isnt( exception { $meta->remove_attribute('fickle') }, undef, '... exception thrown as expected' );

    my $reef = \ 'reef';
    isnt( exception { $meta->add_package_
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/030_method.t ( view source; MetaCPAN )
ed_name is the same as fully_qualified_name'
);

isnt( exception { Class::MOP::Method->wrap }, undef, q{... can't call wrap() without some code} );
isnt( exception { Class::MOP::Method->wrap( [] ) }, 
't call wrap() without some code} );
isnt( exception { Class::MOP::Method->wrap( bless {} => 'Fail' ) }, undef, q{... can't call wrap() without some code} );

isnt( exception { Class::MOP::Method->nam
f, q{... can't call name() as a class method} );
isnt( exception { Class::MOP::Method->body }, undef, q{... can't call body() as a class method} );
isnt( exception { Class::MOP::Method->package_name }
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/020_attribute.t ( view source; MetaCPAN )
est::More;
use Test::Fatal;

use Class::MOP;
use Class::MOP::Attribute;
use Class::MOP::Method;


isnt( exception { Class::MOP::Attribute->name }, undef, q{... can't call name() as a class method} );
    }

    my $attr_clone = $attr->clone();
    isa_ok($attr_clone, 'Class::MOP::Attribute');
    isnt($attr, $attr_clone, '... but they are different instances');

    is($attr->associated_class, $at
    }

    my $attr_clone = $attr->clone();
    isa_ok($attr_clone, 'Class::MOP::Attribute');
    isnt($attr, $attr_clone, '... but they are different instances');

    is($attr->associated_class, $at
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/022_attribute_duplication.t ( view source; MetaCPAN )
;

    my $bar_attr2 = Foo->meta->get_attribute('bar');

    ::isnt($bar_attr, $bar_attr2, '... this is a new bar attribute');
    ::isnt($bar_attr->associated_class, Foo->meta, '... and the old bar a
ribute *is* associated with Foo->meta');

    ::isnt($bar_attr2->reader, 'get_bar', '... the bar attribute no longer has the reader get_bar');
    ::isnt($bar_attr2->reader, 'set_bar', '... the bar at
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/006_new_and_clone_metaclasses.t ( view source; MetaCPAN )
one_object($foo);
isa_ok($cloned_foo, 'Foo');

isnt($cloned_foo, $foo, '... $cloned_foo is a new object different from $foo');

# check some errors

isnt( exception {
    $foo_meta->clone_object($meta
OP::Attribute');

my $attr_clone = $attr->clone();
isa_ok($attr_clone, 'Class::MOP::Attribute');

isnt($attr, $attr_clone, '... we successfully cloned our attributes');
is($attr->associated_class,
   
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/015_metaclass_inheritance.t ( view source; MetaCPAN )
Bar');
isnt($bar_meta, $foo_meta, '... Bar->meta != Foo->meta');

my $baz_meta = Baz->meta;
isa_ok($baz_meta, 'Class::MOP::Class');

is($baz_meta->name, 'Baz', '... baz_meta->name == Baz');
isnt($baz_
meta, $bar_meta, '... Baz->meta != Bar->meta');
isnt($baz_meta, $foo_meta, '... Baz->meta != Foo->meta');

done_testing;
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/301_RT_27329_fix.t ( view source; MetaCPAN )
;

{
    my $clone = $foo->meta->clone_object($foo, foo => 'BAZ');
    isa_ok($clone, 'Foo');
    isnt($clone, $foo, '... and it is a clone');

    is($clone->get_foo, 'BAZ', '... got the right cloned
}

{
    my $clone = $foo->meta->clone_object($foo, foo => undef);
    isa_ok($clone, 'Foo');
    isnt($clone, $foo, '... and it is a clone');

    ok(!defined($clone->get_foo), '... got the right clo
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/060_instance.t ( view source; MetaCPAN )
 for Foo');

my $mi_bar = Bar->meta->get_meta_instance;
isa_ok($mi_bar, "Class::MOP::Instance");

isnt($mi_foo, $mi_bar, '... they are not the same instance');

is_deeply(
    [ sort $mi_bar->get_all_
k($i_foo, "Foo");

{
    my $i_foo_2 = $mi_foo->create_instance;
    isa_ok($i_foo_2, "Foo");
    isnt($i_foo_2, $i_foo, '... not the same instance');
    is_deeply($i_foo, $i_foo_2, '... but the same
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/046_rebless_instance.t ( view source; MetaCPAN )
rent", 'Parent->whoami gives parent');
is($foo->parent, "parent", 'Parent->parent gives parent');
isnt( exception { $foo->child }, undef, "Parent->child method doesn't exist" );

Child->meta->rebless_
rent", 'Parent->whoami gives parent');
is($foo->parent, "parent", 'Parent->parent gives parent');
isnt( exception { $foo->child }, undef, "Parent->child method doesn't exist" );

like( exception { Lef
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/003_methods.t ( view source; MetaCPAN )
oo method' );
ok( !$Foo->has_method('foo'),
    '... !Foo->has_method(foo) we just removed it' );
isnt( exception { Foo->foo }, undef, '... cannot call Foo->foo because it is not there' );

is_deeply(
>meta->add_method( $method->name, $method );

my $new_method = Bar->meta->get_method('objecty');

isnt( $method, $new_method,
    'add_method clones method objects as they are added' );
is( $new_metho
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/080_meta_package.t ( view source; MetaCPAN )
;
use Class::MOP::Package;


isnt( exception { Class::MOP::Package->get_all_package_symbols }, undef, q{... can't call get_all_package_symbols() as a class method} );
isnt( exception { Class::MOP::Pac
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/083_load_class.t ( view source; MetaCPAN )
use strict;
use warnings;
use Test::More;
use Test::Fatal;

require Class::MOP;
use lib 't/lib';

isnt( exception {
    Class::MOP::is_class_loaded()
}, undef, "is_class_loaded with no argument dies" 
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/011_create_class.t ( view source; MetaCPAN )
or');

is($point->x, 2, '... the x attribute was initialized correctly through the metaobject');

isnt( exception {
    $point->x(42);
}, undef, '... cannot write to a read-only accessor' );
is($point
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/017_add_method_modifier.t ( view source; MetaCPAN )
;
is( $savings_account->balance, 200,
    '... got the right savings balance after withdrawal' );
isnt( exception {
    $savings_account->withdraw(250);
}, undef, '... could not withdraw from savings 
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/310_inline_structor.t ( view source; MetaCPAN )
    );
        },
        q{},
        'no warning when replace_destructor is true'
    );

    ::isnt(
        $meta->find_method_by_name('new')->body,
        HasConstructor2->can('new'),
        'H
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/071_immutable_w_custom_metaclass.t ( view source; MetaCPAN )
ok( $meta->can('mymetaclass_attributes'),
        '... meta can do method after immutable' );
    isnt( Scalar::Util::blessed( Baz->meta ),
        Scalar::Util::blessed( Bar->meta ),
        'Baz and
Class-MOP ( F/FL/FLORA/Class-MOP-1.12.tar.gz, FLORA, 2011; MetaCPAN )
Class-MOP/t/013_add_attribute_alternate.t ( view source; MetaCPAN )
or');

is($point->x, 2, '... the x attribute was initialized correctly through the metaobject');

isnt( exception {
    $point->x(42);
}, undef, '... cannot write to a read-only accessor' );
is($point

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.