From: Shawn M Moore Date: Sun, 25 May 2008 01:09:34 +0000 (+0000) Subject: Grab some more meta-tests X-Git-Tag: 0.18_01~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8029a53d3871b640a5669d791d9c019238cba9a8;hp=9ac6e31fefbf38e125f3c29251eb3c6115e1115a;p=gitmo%2FMooseX-AttributeHelpers.git Grab some more meta-tests --- diff --git a/t/004_basic_number.t b/t/004_basic_number.t index 0ca838e..2cf5fab 100644 --- a/t/004_basic_number.t +++ b/t/004_basic_number.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 18; +use Test::More tests => 20; BEGIN { use_ok('MooseX::AttributeHelpers'); @@ -73,4 +73,20 @@ $real->set(-1); $real->abs; -is $real->integer, 1, 'abs 1' \ No newline at end of file +is $real->integer, 1, 'abs 1'; + +## test the meta + +my $attr = $real->meta->get_attribute('integer'); +isa_ok($attr, 'MooseX::AttributeHelpers::Number'); + +is_deeply($attr->provides, { + set => 'set', + add => 'add', + sub => 'sub', + mul => 'mul', + div => 'div', + mod => 'mod', + abs => 'abs', +}, '... got the right provides mapping'); + diff --git a/t/006_basic_bag.t b/t/006_basic_bag.t index a90bbc9..ad5ae6c 100644 --- a/t/006_basic_bag.t +++ b/t/006_basic_bag.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 18; +use Test::More tests => 20; use Test::Exception; BEGIN { @@ -61,5 +61,16 @@ is($stuff->get_count_for('foo'), 1, '... got words now'); is($stuff->get_count_for('bar'), 5, '... got words now'); is($stuff->get_count_for('baz'), 11, '... got words now'); +## test the meta +my $words = $stuff->meta->get_attribute('word_histogram'); +isa_ok($words, 'MooseX::AttributeHelpers::Collection::Bag'); + +is_deeply($words->provides, { + 'add' => 'add_word', + 'get' => 'get_count_for', + 'empty' => 'has_any_words', + 'count' => 'num_words', + 'delete' => 'delete_word', +}, '... got the right provides mapping');