move to teh right name
[gitmo/Moose.git] / t / 100_bugs / 019_moose_octal_defaults.t
CommitLineData
2c0314b3 1#!/usr/bin/env perl
2use Test::More qw(no_plan);
3
4my $package = qq{
5package Test::Moose::Go::Boom;
6use Moose;
7use lib qw(lib);
8
9has 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
15no Moose;
16
17__PACKAGE__->meta->make_immutable;
18};
19
20eval $package;
21$@ ? ::fail($@) : ::pass('quoted 019600 default works');
22my $obj = Test::Moose::Go::Boom->new;
23::is($obj->id, '019600', 'value is still the same');
24
25my $package2 = qq{
26package Test::Moose::Go::Boom2;
27use Moose;
28use lib qw(lib);
29
30has 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
36no Moose;
37
38__PACKAGE__->meta->make_immutable;
39};
40
41
42eval $package2;
43$@ ? ::fail($@) : ::pass('017600 octal default works');
44my $obj = Test::Moose::Go::Boom2->new;
45::is($obj->id, 8064, 'value is still the same');