X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F010_basics%2F003_super_and_override.t;fp=t%2F010_basics%2F003_super_and_override.t;h=0000000000000000000000000000000000000000;hb=829433c47061dd70a608bfcd940113c4172b6950;hp=9e2cc1d938b1c932501b7eb8279b761a8f672c4f;hpb=51c788414482c813eb48fb417b08ba03134ff1a6;p=gitmo%2FMoose.git diff --git a/t/010_basics/003_super_and_override.t b/t/010_basics/003_super_and_override.t deleted file mode 100644 index 9e2cc1d..0000000 --- a/t/010_basics/003_super_and_override.t +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More; -use Test::Fatal; - - -{ - package Foo; - use Moose; - - sub foo { 'Foo::foo' } - sub bar { 'Foo::bar' } - sub baz { 'Foo::baz' } - - package Bar; - use Moose; - - extends 'Foo'; - - override bar => sub { 'Bar::bar -> ' . super() }; - - package Baz; - use Moose; - - extends 'Bar'; - - override bar => sub { 'Baz::bar -> ' . super() }; - override baz => sub { 'Baz::baz -> ' . super() }; - - no Moose; # ensure super() still works after unimport -} - -my $baz = Baz->new(); -isa_ok($baz, 'Baz'); -isa_ok($baz, 'Bar'); -isa_ok($baz, 'Foo'); - -is($baz->foo(), 'Foo::foo', '... got the right value from &foo'); -is($baz->bar(), 'Baz::bar -> Bar::bar -> Foo::bar', '... got the right value from &bar'); -is($baz->baz(), 'Baz::baz -> Foo::baz', '... got the right value from &baz'); - -my $bar = Bar->new(); -isa_ok($bar, 'Bar'); -isa_ok($bar, 'Foo'); - -is($bar->foo(), 'Foo::foo', '... got the right value from &foo'); -is($bar->bar(), 'Bar::bar -> Foo::bar', '... got the right value from &bar'); -is($bar->baz(), 'Foo::baz', '... got the right value from &baz'); - -my $foo = Foo->new(); -isa_ok($foo, 'Foo'); - -is($foo->foo(), 'Foo::foo', '... got the right value from &foo'); -is($foo->bar(), 'Foo::bar', '... got the right value from &bar'); -is($foo->baz(), 'Foo::baz', '... got the right value from &baz'); - -# some error cases - -{ - package Bling; - use Moose; - - sub bling { 'Bling::bling' } - - package Bling::Bling; - use Moose; - - extends 'Bling'; - - sub bling { 'Bling::bling' } - - ::isnt( ::exception { - override 'bling' => sub {}; - }, undef, '... cannot override a method which has a local equivalent' ); - -} - -done_testing;