From: Arthur Axel 'fREW' Schmidt Date: Sat, 5 Sep 2009 22:43:48 +0000 (-0500) Subject: skip meta tests for 070 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b1059f47594e7588397849de3bc93eb03c7a43d9;p=gitmo%2FMoose.git skip meta tests for 070 --- diff --git a/t/070_native_traits/011_counter_with_defaults.t b/t/070_native_traits/011_counter_with_defaults.t index 77a5c71..27c5c36 100644 --- a/t/070_native_traits/011_counter_with_defaults.t +++ b/t/070_native_traits/011_counter_with_defaults.t @@ -3,9 +3,13 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 12; use Test::Moose; +use MetaTest; + { package MyHomePage; use Moose; @@ -37,21 +41,22 @@ $page->reset_counter; is( $page->counter, 0, '... got the original value' ); # check the meta .. - -my $counter = $page->meta->get_attribute('counter'); -does_ok( $counter, 'Moose::Meta::Attribute::Native::Trait::Counter' ); - -is( $counter->type_constraint->name, 'Num', - '... got the expected default type constraint' ); - -is_deeply( - $counter->handles, - { - 'inc_counter' => 'inc', - 'dec_counter' => 'dec', - 'reset_counter' => 'reset', - 'set_counter' => 'set', - }, - '... got the right default handles methods' -); +skip_meta { + my $counter = $page->meta->get_attribute('counter'); + does_ok( $counter, 'Moose::Meta::Attribute::Native::Trait::Counter' ); + + is( $counter->type_constraint->name, 'Num', + '... got the expected default type constraint' ); + + is_deeply( + $counter->handles, + { + 'inc_counter' => 'inc', + 'dec_counter' => 'dec', + 'reset_counter' => 'reset', + 'set_counter' => 'set', + }, + '... got the right default handles methods' + ); +} 3; diff --git a/t/070_native_traits/020_remove_attribute.t b/t/070_native_traits/020_remove_attribute.t index 49b2cba..d5e9aa3 100644 --- a/t/070_native_traits/020_remove_attribute.t +++ b/t/070_native_traits/020_remove_attribute.t @@ -3,9 +3,13 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 11; use Test::Exception; +use MetaTest; + { package MyHomePage; use Moose; @@ -33,17 +37,20 @@ can_ok( $page, $_ ) for qw[ reset_counter ]; -lives_ok { - $page->meta->remove_attribute('counter'); -} -'... removed the counter attribute okay'; +skip_meta { + lives_ok { + $page->meta->remove_attribute('counter'); + } + '... removed the counter attribute okay'; -ok( !$page->meta->has_attribute('counter'), - '... no longer has the attribute' ); + ok( !$page->meta->has_attribute('counter'), + '... no longer has the attribute' ); + + ok( !$page->can($_), "... our class no longer has the $_ method" ) for qw[ + counter + dec_counter + inc_counter + reset_counter + ]; +} 6; -ok( !$page->can($_), "... our class no longer has the $_ method" ) for qw[ - counter - dec_counter - inc_counter - reset_counter -]; diff --git a/t/070_native_traits/201_trait_counter.t b/t/070_native_traits/201_trait_counter.t index 432ab29..3fc02c3 100644 --- a/t/070_native_traits/201_trait_counter.t +++ b/t/070_native_traits/201_trait_counter.t @@ -3,9 +3,13 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 16; use Test::Moose 'does_ok'; +use MetaTest; + { package MyHomePage; use Moose; @@ -58,21 +62,22 @@ $page->dec_counter(5); is( $page->counter, 2, '... decrement by arg' ); # check the meta .. - -my $counter = $page->meta->get_attribute('counter'); -does_ok( $counter, 'Moose::Meta::Attribute::Native::Trait::Counter' ); - -is( $counter->type_constraint->name, 'Int', - '... got the expected type constraint' ); - -is_deeply( - $counter->handles, - { - inc_counter => 'inc', - dec_counter => 'dec', - reset_counter => 'reset', - set_counter => 'set' - }, - '... got the right handles methods' -); - +skip_meta { + my $counter = $page->meta->get_attribute('counter'); + does_ok( $counter, 'Moose::Meta::Attribute::Native::Trait::Counter' ); + + is( $counter->type_constraint->name, 'Int', + '... got the expected type constraint' ); + + is_deeply( + $counter->handles, + { + inc_counter => 'inc', + dec_counter => 'dec', + reset_counter => 'reset', + set_counter => 'set' + }, + '... got the right handles methods' + ); + +} 3; diff --git a/t/070_native_traits/202_trait_array.t b/t/070_native_traits/202_trait_array.t index 25afb92..dbddb59 100644 --- a/t/070_native_traits/202_trait_array.t +++ b/t/070_native_traits/202_trait_array.t @@ -3,10 +3,14 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 68; use Test::Exception; use Test::Moose 'does_ok'; +use MetaTest; + my $sort; { @@ -241,32 +245,34 @@ dies_ok { '... accessor rejects 3 args'; ## test the meta +skip_meta { + my $options = $stuff->meta->get_attribute('options'); + does_ok( $options, 'Moose::Meta::Attribute::Native::Trait::Array' ); + + is_deeply( + $options->handles, + { + 'add_options' => 'push', + 'remove_last_option' => 'pop', + 'remove_first_option' => 'shift', + 'insert_options' => 'unshift', + 'get_option_at' => 'get', + 'set_option_at' => 'set', + 'num_options' => 'count', + 'has_no_options' => 'is_empty', + 'clear_options' => 'clear', + 'splice_options' => 'splice', + 'sort_options_in_place' => 'sort_in_place', + 'option_accessor' => 'accessor', + 'add_options_with_speed' => [ 'push' => 'funrolls', 'funbuns' ], + 'prepend_prerequisites_along_with' => + [ 'unshift' => 'first', 'second' ], + 'descending_options' => [ 'sort_in_place' => $sort ], + }, + '... got the right handles mapping' + ); + + is( $options->type_constraint->type_parameter, 'Str', + '... got the right container type' ); +} 3; -my $options = $stuff->meta->get_attribute('options'); -does_ok( $options, 'Moose::Meta::Attribute::Native::Trait::Array' ); - -is_deeply( - $options->handles, - { - 'add_options' => 'push', - 'remove_last_option' => 'pop', - 'remove_first_option' => 'shift', - 'insert_options' => 'unshift', - 'get_option_at' => 'get', - 'set_option_at' => 'set', - 'num_options' => 'count', - 'has_no_options' => 'is_empty', - 'clear_options' => 'clear', - 'splice_options' => 'splice', - 'sort_options_in_place' => 'sort_in_place', - 'option_accessor' => 'accessor', - 'add_options_with_speed' => [ 'push' => 'funrolls', 'funbuns' ], - 'prepend_prerequisites_along_with' => - [ 'unshift' => 'first', 'second' ], - 'descending_options' => [ 'sort_in_place' => $sort ], - }, - '... got the right handles mapping' -); - -is( $options->type_constraint->type_parameter, 'Str', - '... got the right container type' ); diff --git a/t/070_native_traits/203_trait_hash.t b/t/070_native_traits/203_trait_hash.t index fe2e649..44bc775 100644 --- a/t/070_native_traits/203_trait_hash.t +++ b/t/070_native_traits/203_trait_hash.t @@ -3,10 +3,14 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 46; use Test::Exception; use Test::Moose 'does_ok'; +use MetaTest; + { package Stuff; use Moose; @@ -139,31 +143,32 @@ dies_ok { '... bad constructor params'; ## test the meta - -my $options = $stuff->meta->get_attribute('options'); -does_ok( $options, 'Moose::Meta::Attribute::Native::Trait::Hash' ); - -is_deeply( - $options->handles, - { - 'set_option' => 'set', - 'get_option' => 'get', - 'has_no_options' => 'empty', - 'num_options' => 'count', - 'clear_options' => 'clear', - 'delete_option' => 'delete', - 'has_option' => 'exists', - 'is_defined' => 'defined', - 'option_accessor' => 'accessor', - 'key_value' => 'kv', - 'options_elements' => 'elements', - 'quantity' => [ accessor => 'quantity' ], - }, - '... got the right handles mapping' -); - -is( $options->type_constraint->type_parameter, 'Str', - '... got the right container type' ); +skip_meta { + my $options = $stuff->meta->get_attribute('options'); + does_ok( $options, 'Moose::Meta::Attribute::Native::Trait::Hash' ); + + is_deeply( + $options->handles, + { + 'set_option' => 'set', + 'get_option' => 'get', + 'has_no_options' => 'empty', + 'num_options' => 'count', + 'clear_options' => 'clear', + 'delete_option' => 'delete', + 'has_option' => 'exists', + 'is_defined' => 'defined', + 'option_accessor' => 'accessor', + 'key_value' => 'kv', + 'options_elements' => 'elements', + 'quantity' => [ accessor => 'quantity' ], + }, + '... got the right handles mapping' + ); + + is( $options->type_constraint->type_parameter, 'Str', + '... got the right container type' ); +} 3; $stuff->set_option( oink => "blah", xxy => "flop" ); my @key_value = $stuff->key_value; diff --git a/t/070_native_traits/204_trait_number.t b/t/070_native_traits/204_trait_number.t index 48736f8..56eeafa 100644 --- a/t/070_native_traits/204_trait_number.t +++ b/t/070_native_traits/204_trait_number.t @@ -3,9 +3,13 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 25; use Test::Moose; +use MetaTest; + { package Real; use Moose; @@ -88,25 +92,26 @@ $real->dec; is $real->integer, 12, 'dec 13'; ## test the meta - -my $attr = $real->meta->get_attribute('integer'); -does_ok( $attr, 'Moose::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' -); +skip_meta { + my $attr = $real->meta->get_attribute('integer'); + does_ok( $attr, 'Moose::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' + ); +} 2; diff --git a/t/070_native_traits/205_trait_list.t b/t/070_native_traits/205_trait_list.t index 8e6a37a..d337ecc 100644 --- a/t/070_native_traits/205_trait_list.t +++ b/t/070_native_traits/205_trait_list.t @@ -3,10 +3,14 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 43; use Test::Exception; use Test::Moose 'does_ok'; +use MetaTest; + my $sort; my $less; my $up; @@ -129,36 +133,37 @@ 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, 'Moose::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' ); +skip_meta { + my $options = $stuff->meta->get_attribute('_options'); + does_ok( $options, 'Moose::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' ); +} 3; dies_ok { $stuff->sort_in_place_options(undef); diff --git a/t/070_native_traits/207_trait_string.t b/t/070_native_traits/207_trait_string.t index 7c85ae8..5a403b9 100644 --- a/t/070_native_traits/207_trait_string.t +++ b/t/070_native_traits/207_trait_string.t @@ -3,9 +3,13 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 22; use Test::Moose 'does_ok'; +use MetaTest; + my $uc; { package MyHomePage; @@ -87,30 +91,32 @@ is( $page->string, '', "clear" ); # check the meta .. -my $string = $page->meta->get_attribute('string'); -does_ok( $string, 'Moose::Meta::Attribute::Native::Trait::String' ); - -is( - $string->type_constraint->name, 'Str', - '... got the expected type constraint' -); - -is_deeply( - $string->handles, - { - inc_string => 'inc', - append_string => 'append', - prepend_string => 'prepend', - match_string => 'match', - replace_string => 'replace', - chop_string => 'chop', - chomp_string => 'chomp', - clear_string => 'clear', - length_string => 'length', - exclaim => [ append => '!' ], - capitalize_last => [ replace => qr/(.)$/, $uc ], - invalid_number => [ match => qr/\D/ ], - }, - '... got the right handles methods' -); +skip_meta { + my $string = $page->meta->get_attribute('string'); + does_ok( $string, 'Moose::Meta::Attribute::Native::Trait::String' ); + + is( + $string->type_constraint->name, 'Str', + '... got the expected type constraint' + ); + + is_deeply( + $string->handles, + { + inc_string => 'inc', + append_string => 'append', + prepend_string => 'prepend', + match_string => 'match', + replace_string => 'replace', + chop_string => 'chop', + chomp_string => 'chomp', + clear_string => 'clear', + length_string => 'length', + exclaim => [ append => '!' ], + capitalize_last => [ replace => qr/(.)$/, $uc ], + invalid_number => [ match => qr/\D/ ], + }, + '... got the right handles methods' + ); +} 3;