Commit | Line | Data |
0601096c |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More tests => 7; |
5 | use Test::Fatal; |
6 | use Test::Moose; |
0dc46003 |
7 | use Test::NoWarnings 1.04 ':early'; |
0601096c |
8 | |
9 | { |
10 | package Foo; |
11 | use Moose; |
12 | use MooseX::UndefTolerant; |
13 | |
14 | has 'bar' => ( |
15 | is => 'ro', |
16 | isa => 'Num', |
17 | init_arg => undef, |
18 | ); |
19 | } |
20 | |
21 | package main; |
22 | |
23 | with_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 | |