move to teh right name
[gitmo/Moose.git] / t / 100_bugs / 019_moose_octal_defaults.t
1 #!/usr/bin/env perl
2 use Test::More qw(no_plan);
3
4 my $package = qq{
5 package Test::Moose::Go::Boom;
6 use Moose;
7 use lib qw(lib);
8
9 has id => (
10     isa     => 'Str',
11     is      => 'ro',
12     default => '019600',  # Moose doesn't quote this when inlining, an perl treats it as an octal ... and 9 isn't a valid octal
13 );
14
15 no Moose;
16
17 __PACKAGE__->meta->make_immutable;
18 };
19
20 eval $package;
21 $@ ? ::fail($@) : ::pass('quoted 019600 default works');
22 my $obj = Test::Moose::Go::Boom->new; 
23 ::is($obj->id, '019600', 'value is still the same');
24
25 my $package2 = qq{
26 package Test::Moose::Go::Boom2;
27 use Moose;
28 use lib qw(lib);
29
30 has id => (
31     isa     => 'Str',
32     is      => 'ro',
33     default => 017600,  # Moose doesn't quote this when inlining, an perl treats it as an octal ... and 9 isn't a valid octal
34 );
35
36 no Moose;
37
38 __PACKAGE__->meta->make_immutable;
39 };
40
41
42 eval $package2;
43 $@ ? ::fail($@) : ::pass('017600 octal default works');
44 my $obj = Test::Moose::Go::Boom2->new; 
45 ::is($obj->id, 8064, 'value is still the same');