X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F022-init-arg.t;h=07c221d7bcb46226817c7df5bd7b90971f78b71c;hb=bf6d766ddc05c71b6f4e679d8907f246d3ca4176;hp=aa1bac14aeb04da9fcda0c39c667f61114913ebb;hpb=384072a3e031806229e4b11dfb5c055e8829ff08;p=gitmo%2FMouse.git diff --git a/t/022-init-arg.t b/t/022-init-arg.t index aa1bac1..07c221d 100644 --- a/t/022-init-arg.t +++ b/t/022-init-arg.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 9; +use Test::More tests => 10; do { package Class; @@ -28,3 +28,18 @@ my $attr = $object2->meta->get_attribute('name'); ok($attr, 'got the attribute object by name (not init_arg)'); is($attr->name, 'name', 'name is name'); is($attr->init_arg, 'key', 'init_arg is key'); + +do { + package Foo; + use Mouse; + + has name => ( + is => 'rw', + init_arg => undef, + default => 'default', + ); +}; + +my $foo = Foo->new(name => 'joe'); +is($foo->name, 'default', 'init_arg => undef ignores attribute name in the constructor'); +