ensure strict and warnings is always in effect
[gitmo/MooseX-UndefTolerant.git] / t / basic.t
CommitLineData
4fbe5d7d 1use strict;
2use warnings;
3
cd954cc2 4use Test::More;
5use Test::Moose;
6
7{
8package Foo;
9use Moose;
10use MooseX::UndefTolerant;
11
12has 'bar' => (
13 is => 'ro',
14 isa => 'Num',
15 predicate => 'has_bar'
16);
17
18__PACKAGE__->meta->make_immutable;
19}
20
21package main;
22
23with_immutable {
24 {
25 my $foo = Foo->new;
26 ok(!$foo->has_bar);
27 }
28
29 {
30 my $foo = Foo->new(bar => undef);
31 ok(!$foo->has_bar);
32 }
33
34 {
35 my $foo = Foo->new(bar => 1234);
36 cmp_ok($foo->bar, 'eq', 1234);
37 ok($foo->has_bar);
38 }
39} 'Foo';
40
41done_testing;