From: Stevan Little Date: Tue, 29 Apr 2008 03:31:46 +0000 (+0000) Subject: 0.42 X-Git-Tag: 0_55~205 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c93e8e7d65e9ec42ee58cac8cba61b3327b26b2d;p=gitmo%2FMoose.git 0.42 --- diff --git a/Changes b/Changes index df672a3..0731fba 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,13 @@ Revision history for Perl extension Moose +0.42 Mon. April 28, 2008 + - some bad tests slipped by, nothing else + changed in this release (cpantesters++) + + - upped the Class::MOP dependency to 0.55 + since we have tests which need the C3 + support + 0.41 Mon. April 28, 2008 ~~ numerous documentation updates ~~ diff --git a/Makefile.PL b/Makefile.PL index 5a94024..23fc743 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -12,7 +12,7 @@ my $win32 = !! ( $^O eq 'Win32' or $^O eq 'cygwin' ); # prereqs requires 'Scalar::Util' => $win32 ? '1.17' : '1.18'; requires 'Carp'; -requires 'Class::MOP' => '0.53'; +requires 'Class::MOP' => '0.55'; requires 'Sub::Name' => '0.02'; requires 'Sub::Exporter' => '0.972'; diff --git a/lib/Moose.pm b/lib/Moose.pm index f9d8cd1..eb06efb 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -4,7 +4,7 @@ package Moose; use strict; use warnings; -our $VERSION = '0.41'; +our $VERSION = '0.42'; our $AUTHORITY = 'cpan:STEVAN'; use Scalar::Util 'blessed', 'reftype'; diff --git a/t/030_roles/030_role_parameterized.t b/t/030_roles/030_role_parameterized.t index 7a3da7f..75fbdc5 100644 --- a/t/030_roles/030_role_parameterized.t +++ b/t/030_roles/030_role_parameterized.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More no_plan => 1; +use Test::More tests => 1; use Test::Exception; BEGIN { diff --git a/t/060_compat/003_foreign_inheritence.t b/t/060_compat/003_foreign_inheritence.t index 432b340..8fcb324 100644 --- a/t/060_compat/003_foreign_inheritence.t +++ b/t/060_compat/003_foreign_inheritence.t @@ -82,6 +82,6 @@ lives_ok { } 'Immutability on Moose class extending Class::MOP class ok'; lives_ok { - SubClass2->meta->superclasses([ 'MyBase' ]); + SubClass2->meta->superclasses([ 'MyBase' ]); } 'Can subclass the same non-Moose class twice with different metaclasses'; diff --git a/t/100_bugs/011_DEMOLISH_eats_exceptions.t b/t/100_bugs/011_DEMOLISH_eats_exceptions.t index 4083578..17465f2 100644 --- a/t/100_bugs/011_DEMOLISH_eats_exceptions.t +++ b/t/100_bugs/011_DEMOLISH_eats_exceptions.t @@ -2,190 +2,153 @@ use strict; use warnings; +use FindBin; -use Test::More no_plan => 1; +use Test::More tests => 146; use Test::Exception; -use Test::Deep; -use Data::Dumper; - -BEGIN -{ - use_ok('Moose'); +BEGIN { + use_ok('Moose'); + use_ok('Moose::Util::TypeConstraints'); } +subtype 'FilePath' + => as 'Str' + => where { $_ =~ m#^(/[a-zA-Z0-9_.-]+)+$#; }; + { - use Moose::Util::TypeConstraints; + package Baz; + use Moose; + use Moose::Util::TypeConstraints; + + has 'path' => ( + is => 'ro', + isa => 'FilePath', + required => 1, + ); + + sub BUILD { + my ( $self, $params ) = @_; + confess $params->{path} . " does not exist" + unless -e $params->{path}; + } - subtype 'FilePath' - => as 'Str' - => where { $_ =~ m#^(/[a-zA-Z0-9_.-]+)+$#; }; # '/' (root) forbidden! + # Defining this causes the FIRST call to Baz->new w/o param to fail, + # if no call to ANY Moose::Object->new was done before. + sub DEMOLISH { + my ( $self ) = @_; + } } { - package Baz; - use Moose; - use Moose::Util::TypeConstraints; - - has 'path' => - ( - is => 'ro', - isa => 'FilePath', - required => 1, - ); - - sub BUILD - { - my ( $self, $params ) = @_; - - confess $params->{path} . " does not exist" unless -e $params->{path}; - - # open files etc. - } - - # Defining this causes the FIRST call to Baz->new w/o param to fail, - # if no call to ANY Moose::Object->new was done before. - # - sub DEMOLISH - { - my ( $self ) = @_; - - # cleanup files etc. - } -} + package Qee; + use Moose; + use Moose::Util::TypeConstraints; + + has 'path' => ( + is => 'ro', + isa => 'FilePath', + required => 1, + ); + + sub BUILD { + my ( $self, $params ) = @_; + confess $params->{path} . " does not exist" + unless -e $params->{path}; + } -{ - package Qee; - use Moose; - use Moose::Util::TypeConstraints; - - has 'path' => - ( - is => 'ro', - isa => 'FilePath', - required => 1, - ); - - sub BUILD - { - my ( $self, $params ) = @_; - - confess $params->{path} . " does not exist" unless -e $params->{path}; - - # open files etc. - } - - # Defining this causes the FIRST call to Qee->new w/o param to fail... - # if no call to ANY Moose::Object->new was done before. - # - sub DEMOLISH - { - my ( $self ) = @_; - - # cleanup files etc. - } + # Defining this causes the FIRST call to Qee->new w/o param to fail... + # if no call to ANY Moose::Object->new was done before. + sub DEMOLISH { + my ( $self ) = @_; + } } { - package Foo; - use Moose; - use Moose::Util::TypeConstraints; - - has 'path' => - ( - is => 'ro', - isa => 'FilePath', - required => 1, - ); - - sub BUILD - { - my ( $self, $params ) = @_; - - confess $params->{path} . " does not exist" unless -e $params->{path}; - - # open files etc. - } + package Foo; + use Moose; + use Moose::Util::TypeConstraints; + + has 'path' => ( + is => 'ro', + isa => 'FilePath', + required => 1, + ); + + sub BUILD { + my ( $self, $params ) = @_; + confess $params->{path} . " does not exist" + unless -e $params->{path}; + } - # Having no DEMOLISH, everything works as expected... - # + # Having no DEMOLISH, everything works as expected... } -# Uncomment only one block per test run: -# - -#=pod -check_em ( 'Baz' ); # 'Baz plain' will fail, aka NO error -check_em ( 'Qee' ); # ok -check_em ( 'Foo' ); # ok -#=cut - -#=pod -check_em ( 'Qee' ); # 'Qee plain' will fail, aka NO error -check_em ( 'Baz' ); # ok -check_em ( 'Foo' ); # ok -#=cut - -#=pod -check_em ( 'Foo' ); # ok -check_em ( 'Baz' ); # ok ! -check_em ( 'Qee' ); # ok -#=cut +check_em ( 'Baz' ); # 'Baz plain' will fail, aka NO error +check_em ( 'Qee' ); # ok +check_em ( 'Foo' ); # ok + +check_em ( 'Qee' ); # 'Qee plain' will fail, aka NO error +check_em ( 'Baz' ); # ok +check_em ( 'Foo' ); # ok + +check_em ( 'Foo' ); # ok +check_em ( 'Baz' ); # ok ! +check_em ( 'Qee' ); # ok + + +sub check_em { + my ( $pkg ) = @_; + my ( %param, $obj ); + + # Uncomment to see, that it is really any first call. + # Subsequents calls will not fail, aka giving the correct error. + { + local $@; + my $obj = eval { $pkg->new; }; + ::like( $@, qr/is required/, "... $pkg plain" ); + ::is( $obj, undef, "... the object is undef" ); + } + { + local $@; + my $obj = eval { $pkg->new(); }; + ::like( $@, qr/is required/, "... $pkg empty" ); + ::is( $obj, undef, "... the object is undef" ); + } + { + local $@; + my $obj = eval { $pkg->new ( undef ); }; + ::like( $@, qr/is required/, "... $pkg undef" ); + ::is( $obj, undef, "... the object is undef" ); + } + + { + local $@; + my $obj = eval { $pkg->new ( %param ); }; + ::like( $@, qr/is required/, "... $pkg undef param" ); + ::is( $obj, undef, "... the object is undef" ); + } + { + local $@; + my $obj = eval { $pkg->new ( path => '/' ); }; + ::like( $@, qr/does not pass the type constraint/, "... $pkg root path forbidden" ); + ::is( $obj, undef, "... the object is undef" ); + } + { + local $@; + my $obj = eval { $pkg->new ( path => '/this_path/does/not_exist' ); }; + ::like( $@, qr/does not exist/, "... $pkg non existing path" ); + ::is( $obj, undef, "... the object is undef" ); + } + { + local $@; + my $obj = eval { $pkg->new ( path => $FindBin::Bin ); }; + ::is( $@, '', "... $pkg no error" ); + ::isa_ok( $obj, $pkg ); + ::isa_ok( $obj, 'Moose::Object' ); + ::is( $obj->path, $FindBin::Bin, "... $pkg got the right value" ); + } +} +1; -sub check_em -{ - my ( $pkg ) = @_; - - my ( %param, $obj ); - -# Uncomment to see, that it is really any first call. -# Subsequents calls will not fail, aka giving the correct error. - # - #=pod - { - local $@; - my $obj = eval { $pkg->new; }; - ::like ( $@, qr/is required/, "... $pkg plain" ); - ::is ( $obj, undef, "" ); - } - { - local $@; - my $obj = eval { $pkg->new(); }; - ::like ( $@, qr/is required/, "... $pkg empty" ); - ::is ( $obj, undef, "" ); - } - { - local $@; - my $obj = eval { $pkg->new ( undef ); }; - ::like ( $@, qr/is required/, "... $pkg undef" ); - ::is ( $obj, undef, "" ); - } - #=cut - { - local $@; - my $obj = eval { $pkg->new ( %param ); }; - ::like ( $@, qr/is required/, "... $pkg undef param" ); - ::is ( $obj, undef, "" ); - } - { - local $@; - my $obj = eval { $pkg->new ( path => '/' ); }; - ::like ( $@, qr/does not pass the type constraint/, "... $pkg root path forbidden" ); - ::is ( $obj, undef, "" ); - } - { - local $@; - my $obj = eval { $pkg->new ( path => '/this_path/does/not_exist' ); }; - ::like ( $@, qr/does not exist/, "... $pkg non existing path" ); - ::is ( $obj, undef, "" ); - } - { - local $@; - my $obj = eval { $pkg->new ( path => '/tmp' ); }; - ::is ( $@, '', "... $pkg no error" ); - ::isa_ok ( $obj, $pkg ); - ::isa_ok ( $obj, 'Moose::Object' ); - ::is ( $obj->path, '/tmp', "... $pkg got the right value" ); - } -} \ No newline at end of file diff --git a/t/300_immutable/002_apply_roles_to_immutable.t b/t/300_immutable/002_apply_roles_to_immutable.t index e4e0c3e..c1ba765 100644 --- a/t/300_immutable/002_apply_roles_to_immutable.t +++ b/t/300_immutable/002_apply_roles_to_immutable.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More no_plan => 1; +use Test::More tests => 5; use Test::Exception; BEGIN {