Group
Extension

Matches 79

Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/cmop/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
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/cmop/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
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/cmop/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
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/type_constraints/types_and_undef.t ( view source; MetaCPAN )
Foo->Undef' );
isnt( exception { $foo->vDefined(undef) }, undef, '... undef is NOT a Foo->Defined' );
isnt( exception { $foo->vInt(undef) }, undef, '... undef is NOT a Foo->Int' );
isnt( exception { $
Foo->Number' );
isnt( exception { $foo->vStr(undef) }, undef, '... undef is NOT a Foo->Str' );
isnt( exception { $foo->vString(undef) }, undef, '... undef is NOT a Foo->String' );

isnt( exception { $
ception { $foo->vStr(5) }, undef, '... 5 is a Foo->Str' );
isnt( exception { $foo->vString(5) }, undef, '... 5 is NOT a Foo->String' );

isnt( exception { $foo->vUndef(0.5) }, undef, '... 0.5 is NOT a
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/attributes/attribute_inherited_slot_specs.t ( view source; MetaCPAN )
 '... we can add the handles attribute option' );

    # this one will *not* work here ....
    ::isnt( ::exception {
        has '+blang' => (handles => ['hello']);
    }, undef, '... we can not alte
Ref');
    }, undef, '... can now create an attribute with an improper subtype relation' );
    ::isnt( ::exception {
        has '+other_fail' => (trigger => sub {});
    }, undef, '... cannot create
right value for foo');

isnt( exception { $foo->foo([]) }, undef, '... foo is not coercing (as expected)' );

is($foo->bar, 'Foo::bar', '... got the right default value');
isnt( exception { $foo->bar(
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/cmop/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_
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/cmop/method.t ( view source; MetaCPAN )
>is_stub,
    '... the method is not a stub' );

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 }
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/recipes/basics_point_attributesandsubclassing.t ( view source; MetaCPAN )
.. got the right (changed) value for y' );

isnt(
    exception {
        $point->y('Foo');
    },
    undef,
    '... cannot assign a non-Int to y'
);

isnt(
    exception {
        Point->new();
   
... can assign a 0 to x and y'
);

isnt(
    exception {
        Point->new( x => 10, y => 'Foo' );
    },
    undef,
    '... cannot assign a non-Int to y'
);

isnt(
    exception {
        Point->ne
ht (cleared) value for z' );

isnt(
    exception {
        Point3D->new( x => 10, y => 'Foo', z => 3 );
    },
    undef,
    '... cannot assign a non-Int to y'
);

isnt(
    exception {
        Poin
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/native_traits/array_subtypes.t ( view source; MetaCPAN )
$foo->array_int( [] );
    is_deeply( $foo->array_int, [], "array_int - correct contents" );

    isnt( exception { $foo->push_array_int('foo') }, undef, "array_int - can't push wrong type" );
    is_
nts" );
}

{
    isnt( exception { $foo->push_a1('foo') }, undef, "a1 - can't push onto undef" );

    $foo->a1( [] );
    is_deeply( $foo->a1, [], "a1 - correct contents" );

    isnt( exception { $f
ents" );

    $foo->push_a1(1);
    is_deeply( $foo->a1, [1], "a1 - correct contents" );
}

{
    isnt( exception { $foo->push_a2('foo') }, undef, "a2 - can't push onto undef" );

    $foo->a2( [] );
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/native_traits/hash_subtypes.t ( view source; MetaCPAN )
   $foo->hash_int( {} );
    is_deeply( $foo->hash_int, {}, "hash_int - correct contents" );

    isnt( exception { $foo->set_hash_int( x => 'foo' ) }, undef, "hash_int - can't set wrong type" );
    
ents" );
}

{
    isnt( exception { $foo->set_h1('foo') }, undef, "h1 - can't set onto undef" );

    $foo->h1( {} );
    is_deeply( $foo->h1, {}, "h1 - correct contents" );

    isnt( exception { $fo
 $foo->set_h1( x => 1 );
    is_deeply( $foo->h1, { x => 1 }, "h1 - correct contents" );
}

{
    isnt( exception { $foo->set_h2('foo') }, undef, "h2 - can't set onto undef" );

    $foo->h2( {} );
  
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/attributes/attribute_type_unions.t ( view source; MetaCPAN )
 '... set bar successfully with a HASH ref' );

isnt( exception {
    $foo->bar(100)
}, undef, '... couldnt set bar successfully with a number' );

isnt( exception {
    $foo->bar(sub {})
}, undef, '.
th bar successfully set with a HASH ref' );

isnt( exception {
    Foo->new(bar => 50)
}, undef, '... didnt create a new Foo with bar as a number' );

isnt( exception {
    Foo->new(bar => sub {})
}, 
set baz successfully with a CODE ref' );

isnt( exception {
    $bar->baz(\(my $var1))
}, undef, '... couldnt set baz successfully with a SCALAR ref' );

isnt( exception {
    $bar->baz({})
}, undef, 
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/cmop/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
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/recipes/basics_company_subtypes.t ( view source; MetaCPAN )
 error conditions for the subtypes

isnt(
    exception {
        Address->new( street => {} ),;
    },
    undef,
    '... we die correctly with bad args'
);

isnt(
    exception {
        Address->n
ew( city => {} ),;
    },
    undef,
    '... we die correctly with bad args'
);

isnt(
    exception {
        Address->new( state => 'British Columbia' ),;
    },
    undef,
    '... we die correctl
>new( state => 'Connecticut' ),;
    },
    undef,
    '... we live correctly with good args'
);

isnt(
    exception {
        Address->new( zip_code => 'AF5J6$' ),;
    },
    undef,
    '... we die
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/recipes/basics_http_subtypesandcoercion.t ( view source; MetaCPAN )
=> 'text/plain' } );

    my $header2 = $r->headers;
    isa_ok( $header2, 'HTTP::Headers' );
    isnt( $header, $header2, '... created a new HTTP::Header object' );

    is( $header2->content_type, '
 => 'text/html' ] );

    my $header3 = $r->headers;
    isa_ok( $header3, 'HTTP::Headers' );
    isnt( $header2, $header3, '... created a new HTTP::Header object' );

    is( $header3->content_type, 
;
    isnt( $header3, $header4, '... created a new HTTP::Header object' );

    is( $header4->content_type, 'application/pdf',
        '... got the right content type in the header' );

    isnt(
    
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/examples/example_w_DCS.t ( view source; MetaCPAN )
tly');

isnt( exception {
    $foo->bar([]);
}, undef, '... validation failed correctly' );

isnt( exception {
    $foo->bar({ foo => 3 });
}, undef, '... validation failed correctly' );

isnt( except
});
}, undef, '... validation failed correctly' );

isnt( exception {
    $foo->baz([ "foo" ]);
}, undef, '... validation failed correctly' );

isnt( exception {
    $foo->baz({});
}, undef, '... vali
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/roles/apply_role.t ( view source; MetaCPAN )
( $foobar_class_meta, 'Moose::Meta::Class' );

isnt( exception {
    $foo_class_meta->does_role();
}, undef, '... does_role requires a role name' );

isnt( exception {
    $foo_class_meta->add_role();

}, undef, '... apply_role requires a role' );

isnt( exception {
    $foo_class_meta->add_role( bless( {} => 'Fail' ) );
}, undef, '... apply_role requires a role' );

ok( $foo_class_meta->does_role(
$foo->bar ), '... $foo->bar is undefined' );

    isnt( exception {
        $foo->baz(1);
    }, undef, '... baz is a read-only accessor' );

    isnt( exception {
        $foo->bar(1);
    }, undef, 
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/attributes/attribute_does.t ( view source; MetaCPAN )

isnt( exception {
    $foo->bar($foo);
}, undef, '... foo did not pass the type constraint okay' );

is( exception {
    $foo->baz($bar);
}, undef, '... baz passed the type constraint okay' );

isnt(
hen see if Class->does(Role)
    # if it does not,.. we have a conflict... so we die loudly
    ::isnt( ::exception {
        has 'foo' => (isa => 'Foo::Class', does => 'Bar::Class');
    }, undef, '.
hen see if Class->does(Role)
    # if it does not,.. we have a conflict... so we die loudly
    ::isnt( ::exception {
        has 'foo' => (isa => 'Bling', does => 'Bar::Class');
    }, undef, '... ca
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/cmop/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
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/type_constraints/maybe_type_constraint.t ( view source; MetaCPAN )
[], bar => Bar->new);
}, undef, '... Bar->new isa Bar' );

isnt( exception {
    Foo->new(arr => [], bar => undef);
}, undef, '... undef isnta Bar' );

is( exception {
    Foo->new(arr => [], maybe_ba
ybe_bar => undef);
}, undef, '... undef isa maybe(Bar)' );

isnt( exception {
    Foo->new(arr => [], maybe_bar => 1);
}, undef, '... 1 isnta maybe(Bar)' );

is( exception {
    Foo->new(arr => []);
}
Foo->new(arr => undef);
}, undef, '... it worked!' );

isnt( exception {
    Foo->new(arr => 100);
}, undef, '... failed the type check' );

isnt( exception {
    Foo->new(arr => 'hello world');
}, un
Moose ( E/ET/ETHER/Moose-2.2201.tar.gz, ETHER, 2021; MetaCPAN )
Moose/t/metaclasses/create_anon_with_required_attr.t ( view source; MetaCPAN )
red attr' );
isa_ok( $anon, 'My::Metaclass' );
cmp_ok( $anon->foo, 'eq', 'this', 'foo is this' );
isnt( exception {
    $anon = My::Metaclass->create_anon_class();
}, undef, 'failed to create anon cla
t',        'foo is that' );
cmp_ok( $meta->name, 'eq', 'Class::Name1', 'for the correct class' );
isnt( exception {
    $meta
        = My::Metaclass->initialize( 'Class::Name2' );
}, undef, 'failed t
        'foo is another' );
cmp_ok( $meta->name, 'eq', 'Class::Name3', 'for the correct class' );
isnt( exception {
    eval qq{
        package Class::Name4;
        use metaclass 'My::Metaclass';
  

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