From: Fuji, Goro Date: Sat, 25 Sep 2010 02:28:03 +0000 (+0900) Subject: Don't include tests on native traits X-Git-Tag: 0.72~35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=677ad8d01df4961c767a6f85c57d1c6e72933924;p=gitmo%2FMouse.git Don't include tests on native traits --- diff --git a/Moose-t-failing/060_compat/004_entimwm b/Moose-t-failing/060_compat/004_entimwm deleted file mode 100644 index c35bba6..0000000 --- a/Moose-t-failing/060_compat/004_entimwm +++ /dev/null @@ -1,226 +0,0 @@ -use strict; -# This is automatically generated by author/import-moose-test.pl. -# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! -use t::lib::MooseCompat; -use warnings; -use Test::More; -$TODO = q{Mouse is not yet completed}; -use Mouse::Meta (); - -{ - package My::Role; - use Mouse::Role; -} - -{ - package SomeClass; - use Mouse -traits => 'My::Role'; -} - -{ - package SubClassUseBase; - use base qw/SomeClass/; -} - -{ - package SubSubClassUseBase; - use Mouse; - use Test::More; -$TODO = q{Mouse is not yet completed}; - use Test::Exception; - lives_ok { - extends 'SubClassUseBase'; - } - 'Can extend non-Mouse class with parent class that is a Mouse class with a meta role'; -} - -{ - ok( SubSubClassUseBase->meta->meta->can('does_role') - && SubSubClassUseBase->meta->meta->does_role('My::Role'), - 'SubSubClassUseBase meta metaclass does the My::Role role' ); -} - -# Note, remove metaclasses of the 'use base' classes after each test, -# so that they have to be re-initialized - otherwise latter tests -# would not demonstrate the original issue. -Mouse::Util::remove_metaclass_by_name('SubClassUseBase'); - -{ - package OtherClass; - use Mouse; -} - -{ - package OtherSubClassUseBase; - use base 'OtherClass'; -} - -{ - package MultiParent1; - use Mouse; - use Test::More; -$TODO = q{Mouse is not yet completed}; - use Test::Exception; - lives_ok { - extends qw( SubClassUseBase OtherSubClassUseBase ); - } - 'Can extend two non-Mouse classes with parents that are different Mouse metaclasses'; -} - -{ - ok( MultiParent1->meta->meta->can('does_role') - && MultiParent1->meta->meta->does_role('My::Role'), - 'MultiParent1 meta metaclass does the My::Role role' ); -} - -Mouse::Util::remove_metaclass_by_name($_) - for qw( SubClassUseBase OtherSubClassUseBase ); - -{ - package MultiParent2; - use Mouse; - use Test::More; -$TODO = q{Mouse is not yet completed}; - use Test::Exception; - lives_ok { - extends qw( OtherSubClassUseBase SubClassUseBase ); - } - 'Can extend two non-Mouse classes with parents that are different Mouse metaclasses (reverse order)'; -} - -{ - ok( MultiParent2->meta->meta->can('does_role') - && MultiParent2->meta->meta->does_role('My::Role'), - 'MultiParent2 meta metaclass does the My::Role role' ); -} - -Mouse::Util::remove_metaclass_by_name($_) - for qw( SubClassUseBase OtherSubClassUseBase ); - -{ - package MultiParent3; - use Mouse; - use Test::More; -$TODO = q{Mouse is not yet completed}; - use Test::Exception; - lives_ok { - extends qw( OtherClass SubClassUseBase ); - } - 'Can extend one Mouse class and one non-Mouse class'; -} - -{ - ok( MultiParent3->meta->meta->can('does_role') - && MultiParent3->meta->meta->does_role('My::Role'), - 'MultiParent3 meta metaclass does the My::Role role' ); -} - -Mouse::Util::remove_metaclass_by_name($_) - for qw( SubClassUseBase OtherSubClassUseBase ); - -{ - package MultiParent4; - use Mouse; - use Test::More; -$TODO = q{Mouse is not yet completed}; - use Test::Exception; - lives_ok { - extends qw( SubClassUseBase OtherClass ); - } - 'Can extend one non-Mouse class and one Mouse class'; -} - -{ - ok( MultiParent4->meta->meta->can('does_role') - && MultiParent4->meta->meta->does_role('My::Role'), - 'MultiParent4 meta metaclass does the My::Role role' ); -} - -Mouse::Util::remove_metaclass_by_name($_) - for qw( SubClassUseBase OtherSubClassUseBase ); - -{ - package MultiChild1; - use Mouse; - use Test::More; -$TODO = q{Mouse is not yet completed}; - use Test::Exception; - lives_ok { - extends 'MultiParent1'; - } - 'Can extend class that itself extends two non-Mouse classes with Mouse parents'; -} - -{ - ok( MultiChild1->meta->meta->can('does_role') - && MultiChild1->meta->meta->does_role('My::Role'), - 'MultiChild1 meta metaclass does the My::Role role' ); -} - -Mouse::Util::remove_metaclass_by_name($_) - for qw( SubClassUseBase OtherSubClassUseBase ); - -{ - package MultiChild2; - use Mouse; - use Test::More; -$TODO = q{Mouse is not yet completed}; - use Test::Exception; - lives_ok { - extends 'MultiParent2'; - } - 'Can extend class that itself extends two non-Mouse classes with Mouse parents (reverse order)'; -} - -{ - ok( MultiChild2->meta->meta->can('does_role') - && MultiChild2->meta->meta->does_role('My::Role'), - 'MultiChild2 meta metaclass does the My::Role role' ); -} - -Mouse::Util::remove_metaclass_by_name($_) - for qw( SubClassUseBase OtherSubClassUseBase ); - -{ - package MultiChild3; - use Mouse; - use Test::More; -$TODO = q{Mouse is not yet completed}; - use Test::Exception; - lives_ok { - extends 'MultiParent3'; - } - 'Can extend class that itself extends one Mouse and one non-Mouse parent'; -} - -{ - ok( MultiChild3->meta->meta->can('does_role') - && MultiChild3->meta->meta->does_role('My::Role'), - 'MultiChild3 meta metaclass does the My::Role role' ); -} - -Mouse::Util::remove_metaclass_by_name($_) - for qw( SubClassUseBase OtherSubClassUseBase ); - -{ - package MultiChild4; - use Mouse; - use Test::More; -$TODO = q{Mouse is not yet completed}; - use Test::Exception; - lives_ok { - extends 'MultiParent4'; - } - 'Can extend class that itself extends one non-Mouse and one Mouse parent'; -} - -{ - ok( MultiChild4->meta->meta->can('does_role') - && MultiChild4->meta->meta->does_role('My::Role'), - 'MultiChild4 meta metaclass does the My::Role role' ); -} - -Mouse::Util::remove_metaclass_by_name($_) - for qw( SubClassUseBase OtherSubClassUseBase ); - -done_testing; diff --git a/Moose-t-failing/070_native_traits/000_load.t b/Moose-t-failing/070_native_traits/000_load.t deleted file mode 100644 index 96880cb..0000000 --- a/Moose-t-failing/070_native_traits/000_load.t +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/perl -# This is automatically generated by author/import-moose-test.pl. -# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! -use t::lib::MooseCompat; - -use strict; -use warnings; - -use Test::More; -$TODO = q{Mouse is not yet completed}; -use Mouse (); - -BEGIN { - use_ok('Mouse::Meta::Attribute::Native'); - use_ok('Mouse::Meta::Attribute::Native::Trait::Bool'); - use_ok('Mouse::Meta::Attribute::Native::Trait::Hash'); - use_ok('Mouse::Meta::Attribute::Native::Trait::Array'); - use_ok('Mouse::Meta::Attribute::Native::Trait::Counter'); - use_ok('Mouse::Meta::Attribute::Native::Trait::Number'); - use_ok('Mouse::Meta::Attribute::Native::Trait::String'); -} - -done_testing; diff --git a/Moose-t-failing/070_native_traits/204_trait_number.t b/Moose-t-failing/070_native_traits/204_trait_number.t deleted file mode 100644 index c40757e..0000000 --- a/Moose-t-failing/070_native_traits/204_trait_number.t +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/perl -# This is automatically generated by author/import-moose-test.pl. -# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! -use t::lib::MooseCompat; - -use strict; -use warnings; - -use Test::More; -$TODO = q{Mouse is not yet completed}; -use Test::Mouse; - -{ - package Real; - use Mouse; - - has 'integer' => ( - traits => ['Number'], - is => 'ro', - isa => 'Int', - default => 5, - handles => { - set => 'set', - add => 'add', - sub => 'sub', - mul => 'mul', - div => 'div', - mod => 'mod', - abs => 'abs', - inc => [ add => 1 ], - dec => [ sub => 1 ], - odd => [ mod => 2 ], - cut_in_half => [ div => 2 ], - - }, - ); -} - -my $real = Real->new; -isa_ok( $real, 'Real' ); - -can_ok( $real, $_ ) for qw[ - set add sub mul div mod abs inc dec odd cut_in_half -]; - -is $real->integer, 5, 'Default to five'; - -$real->add(10); - -is $real->integer, 15, 'Add ten for fithteen'; - -$real->sub(3); - -is $real->integer, 12, 'Subtract three for 12'; - -$real->set(10); - -is $real->integer, 10, 'Set to ten'; - -$real->div(2); - -is $real->integer, 5, 'divide by 2'; - -$real->mul(2); - -is $real->integer, 10, 'multiplied by 2'; - -$real->mod(2); - -is $real->integer, 0, 'Mod by 2'; - -$real->set(7); - -$real->mod(5); - -is $real->integer, 2, 'Mod by 5'; - -$real->set(-1); - -$real->abs; - -is $real->integer, 1, 'abs 1'; - -$real->set(12); - -$real->inc; - -is $real->integer, 13, 'inc 12'; - -$real->dec; - -is $real->integer, 12, 'dec 13'; - -## test the meta - -my $attr = $real->meta->get_attribute('integer'); -does_ok( $attr, 'Mouse::Meta::Attribute::Native::Trait::Number' ); - -is_deeply( - $attr->handles, - { - set => 'set', - add => 'add', - sub => 'sub', - mul => 'mul', - div => 'div', - mod => 'mod', - abs => 'abs', - inc => [ add => 1 ], - dec => [ sub => 1 ], - odd => [ mod => 2 ], - cut_in_half => [ div => 2 ], - }, - '... got the right handles mapping' -); - -done_testing; diff --git a/Moose-t-failing/070_native_traits/205_trait_list.t b/Moose-t-failing/070_native_traits/205_trait_list.t deleted file mode 100644 index 1a58502..0000000 --- a/Moose-t-failing/070_native_traits/205_trait_list.t +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/perl -# This is automatically generated by author/import-moose-test.pl. -# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! -use t::lib::MooseCompat; - -use strict; -use warnings; - -use Test::More; -$TODO = q{Mouse is not yet completed}; -use Test::Exception; -use Test::Mouse 'does_ok'; - -my $sort; -my $less; -my $up; -my $prod; -{ - package Stuff; - use Mouse; - - has '_options' => ( - traits => ['Array'], - is => 'ro', - isa => 'ArrayRef[Int]', - init_arg => 'options', - default => sub { [] }, - handles => { - 'num_options' => 'count', - 'has_no_options' => 'is_empty', - 'map_options', => 'map', - 'filter_options' => 'grep', - 'find_option' => 'first', - 'options' => 'elements', - 'join_options' => 'join', - 'get_option_at' => 'get', - 'sorted_options' => 'sort', - 'randomized_options' => 'shuffle', - 'unique_options' => 'uniq', - 'less_than_five' => [ grep => ($less = sub { $_ < 5 }) ], - 'up_by_one' => [ map => ($up = sub { $_ + 1 }) ], - 'pairwise_options' => [ natatime => 2 ], - 'dashify' => [ join => '-' ], - 'descending' => [ sort => ($sort = sub { $_[1] <=> $_[0] }) ], - 'product' => [ reduce => ($prod = sub { $_[0] * $_[1] }) ], - }, - ); - -} - -my $stuff = Stuff->new( options => [ 1 .. 10 ] ); -isa_ok( $stuff, 'Stuff' ); - -can_ok( $stuff, $_ ) for qw[ - _options - num_options - has_no_options - map_options - filter_options - find_option - options - join_options - get_option_at - sorted_options - randomized_options - unique_options - less_than_five - up_by_one - pairwise_options - dashify - descending - product -]; - -is_deeply( $stuff->_options, [ 1 .. 10 ], '... got options' ); - -ok( !$stuff->has_no_options, '... we have options' ); -is( $stuff->num_options, 10, '... got 2 options' ); -cmp_ok( $stuff->get_option_at(0), '==', 1, '... get option 0' ); - -is_deeply( - [ $stuff->filter_options( sub { $_ % 2 == 0 } ) ], - [ 2, 4, 6, 8, 10 ], - '... got the right filtered values' -); - -is_deeply( - [ $stuff->map_options( sub { $_ * 2 } ) ], - [ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 ], - '... got the right mapped values' -); - -is( $stuff->find_option( sub { $_ % 2 == 0 } ), 2, - '.. found the right option' ); - -is_deeply( [ $stuff->options ], [ 1 .. 10 ], '... got the list of options' ); - -is( $stuff->join_options(':'), '1:2:3:4:5:6:7:8:9:10', - '... joined the list of options by :' ); - -is_deeply( - [ $stuff->sorted_options ], [ sort ( 1 .. 10 ) ], - '... got sorted options (default sort order)' -); -is_deeply( - [ $stuff->sorted_options( sub { $_[1] <=> $_[0] } ) ], - [ sort { $b <=> $a } ( 1 .. 10 ) ], - '... got sorted options (descending sort order) ' -); - -throws_ok { $stuff->sorted_options('foo') } -qr/Argument must be a code reference/, - 'error when sort receives a non-coderef argument'; - -is_deeply( [ sort { $a <=> $b } $stuff->randomized_options ], [ 1 .. 10 ] ); - -my @pairs; -$stuff->pairwise_options(sub { push @pairs, [@_] }); -is_deeply( \@pairs, [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9, 10 ] ] ); - -# test the currying -is_deeply( [ $stuff->less_than_five() ], [ 1 .. 4 ] ); - -is_deeply( [ $stuff->up_by_one() ], [ 2 .. 11 ] ); - -is( $stuff->dashify, '1-2-3-4-5-6-7-8-9-10' ); - -is_deeply( [ $stuff->descending ], [ reverse 1 .. 10 ] ); - -is( $stuff->product, 3628800 ); - -my $other_stuff = Stuff->new( options => [ 1, 1, 2, 3, 5 ] ); -is_deeply( [ $other_stuff->unique_options ], [1, 2, 3, 5] ); - -## test the meta - -my $options = $stuff->meta->get_attribute('_options'); -does_ok( $options, 'Mouse::Meta::Attribute::Native::Trait::Array' ); - -is_deeply( - $options->handles, - { - 'num_options' => 'count', - 'has_no_options' => 'is_empty', - 'map_options', => 'map', - 'filter_options' => 'grep', - 'find_option' => 'first', - 'options' => 'elements', - 'join_options' => 'join', - 'get_option_at' => 'get', - 'sorted_options' => 'sort', - 'randomized_options' => 'shuffle', - 'unique_options' => 'uniq', - 'less_than_five' => [ grep => $less ], - 'up_by_one' => [ map => $up ], - 'pairwise_options' => [ natatime => 2 ], - 'dashify' => [ join => '-' ], - 'descending' => [ sort => $sort ], - 'product' => [ reduce => $prod ], - }, - '... got the right handles mapping' -); - -is( $options->type_constraint->type_parameter, 'Int', - '... got the right container type' ); - -dies_ok { - $stuff->sort_in_place_options(undef); -} -'... sort rejects arg of invalid type'; - -done_testing; diff --git a/author/import-moose-test.pl b/author/import-moose-test.pl index 86ed87b..fcb6db8 100644 --- a/author/import-moose-test.pl +++ b/author/import-moose-test.pl @@ -14,6 +14,7 @@ $result //= 'Moose-t'; my @tests; sub wanted { + return if /native_traits/; (my $mouse_test = $_) =~ s{\A $moose_dir/t }{$result}xmso; (my $mouse_failing_test = $_) =~ s{\A $moose_dir/t }{$result-failing}xmso; if( -d $_ ) {