oops, :early was added in 1.04, not 0.94
[gitmo/MooseX-UndefTolerant.git] / t / undef_init_arg.t
CommitLineData
0601096c 1use strict;
2use warnings;
3
4use Test::More tests => 7;
5use Test::Fatal;
6use Test::Moose;
0dc46003 7use Test::NoWarnings 1.04 ':early';
0601096c 8
9{
10package Foo;
11use Moose;
12use MooseX::UndefTolerant;
13
14has 'bar' => (
15 is => 'ro',
16 isa => 'Num',
17 init_arg => undef,
18);
19}
20
21package main;
22
23with_immutable
24{
25 is(exception { my $foo = Foo->new }, undef, 'constructed with no args');
26
27 is(exception { my $foo = Foo->new(bar => undef) }, undef, 'constructed with undef value');
28
29 is(exception { my $foo = Foo->new(bar => 1234) }, undef, 'constructed with defined value');
30} 'Foo';
31