From: Stevan Little Date: Tue, 20 May 2008 15:35:42 +0000 (+0000) Subject: fixed the test for method modifiers X-Git-Tag: 0_55~158 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=634c8bdabaa067fd7ebd2d45f280f4b02626e970;p=gitmo%2FMoose.git fixed the test for method modifiers --- diff --git a/t/010_basics/010_method_keyword.t b/t/010_basics/010_method_keyword.t deleted file mode 100644 index 9384c5d..0000000 --- a/t/010_basics/010_method_keyword.t +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More tests => 1; - -BEGIN { - use_ok('Moose'); -} - -1; - -__END__ - -=pod - -I dont think I am going to keep this feature, but -the tests are commented out for now. - -{ - package Foo; - use Moose; - - sub greetings { - "Hello, $_[1]"; - } - - method 'greet_world_from' => sub { - my $from = shift; - self->greetings("World") . " from $from"; - }; - - method 'greet_world_from_me' => sub { - self->greet_world_from("Stevan"); - }; - - no Moose; -} - -my $foo = Foo->new; -isa_ok($foo, 'Foo'); - -is($foo->greetings('World'), 'Hello, World', '... got the right value from greetings'); -is($foo->greet_world_from('Stevan'), 'Hello, World from Stevan', '... got the right value from greet_world_from'); -is($foo->greet_world_from_me, 'Hello, World from Stevan', '... got the right value from greet_world'); - -=cut \ No newline at end of file diff --git a/t/500_test_moose/005_method_modifier_with_regexp.t b/t/010_basics/010_method_modifier_with_regexp.t similarity index 74% rename from t/500_test_moose/005_method_modifier_with_regexp.t rename to t/010_basics/010_method_modifier_with_regexp.t index 23a1fab..d52f7f7 100644 --- a/t/500_test_moose/005_method_modifier_with_regexp.t +++ b/t/010_basics/010_method_modifier_with_regexp.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 10; BEGIN { use_ok('Moose'); @@ -100,16 +100,17 @@ is( $Cat::AFTER_BARK_COUNTER, 2, 'after modifier is called twice' ); override 'bark_once' => sub { my $self = shift; + super(); return 'cow'; }; override 'bark_twice' => sub { + super(); return 'cowcow'; }; } -TODO: { - local $TODO = "method modifier isn't called if method id overridden"; +{ my $cow = Cow->new; $cow->bark_once; is( $Animal::BEFORE_BARK_COUNTER, 1, @@ -120,37 +121,6 @@ TODO: { { - package Penguin; - use Moose; - extends 'Animal'; - our $AUGMENT_CALLED = 0; - - augment 'bark_once' => sub { - my $self = shift; - $self->dummy; - inner(); - $self->dummy; - }; - - sub dummy { - $AUGMENT_CALLED++; - } -} -$Animal::BEFORE_BARK_COUNTER = 0; -$Animal::AFTER_BARK_COUNTER = 0; -my $penguin = Penguin->new; -warn $penguin->bark_once; -is( $Animal::BEFORE_BARK_COUNTER, 1, - 'before modifier is called if augment is used' ); -is( $Animal::AFTER_BARK_COUNTER, 1, - 'after modifier is called if augment is used' ); -TODO: { - local $TODO = "The method modifier isn't called if the augment specified it"; - is( $Penguin::AUGMENT_CALLED, 2, 'augment is called' ); -} - -{ - package MyDog; use Moose; our $BEFORE_BARK_COUNTER=0;