X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fmetaclasses%2Foverloading.t;h=ba5f1d5e1e28be4c827314e2201d355884a9a506;hb=702be3d89ea803c8ece85c0bfaccfdff72f6cd0b;hp=f2227c8adaae470499684574739a9f9f4a7c4f95;hpb=c18e272e9602650d75112d2921d67abe167b7b6d;p=gitmo%2FMoose.git diff --git a/t/metaclasses/overloading.t b/t/metaclasses/overloading.t index f2227c8..ba5f1d5 100644 --- a/t/metaclasses/overloading.t +++ b/t/metaclasses/overloading.t @@ -20,10 +20,10 @@ use Test::Fatal; ok(!$meta->has_overloaded_operator('+')); ok(!$meta->has_overloaded_operator('-')); - is_deeply([$meta->get_overloaded_operators], []); - is_deeply([$meta->get_overload_list], []); + is_deeply([$meta->get_all_overloaded_operators], []); + is($meta->get_overloaded_operator('+'), undef); is($meta->get_overloaded_operator('-'), undef); } @@ -45,9 +45,9 @@ BEGIN { $plus_impl = sub { $plus = 1; "plus" } } ok($meta->has_overloaded_operator('+')); ok(!$meta->has_overloaded_operator('-')); - is_deeply([$meta->get_overloaded_operators], ['+']); + is_deeply([$meta->get_overload_list], ['+']); - my @overloads = $meta->get_overload_list; + my @overloads = $meta->get_all_overloaded_operators; is(scalar(@overloads), 1); my $plus_meth = $overloads[0]; isa_ok($plus_meth, 'Class::MOP::Method::Overload'); @@ -79,9 +79,9 @@ BEGIN { $plus_impl = sub { $plus = 1; "plus" } } ok($meta->has_overloaded_operator('-')); - is_deeply([sort $meta->get_overloaded_operators], ['+', '-']); + is_deeply([sort $meta->get_overload_list], ['+', '-']); - is(scalar($meta->get_overload_list), 2); + is(scalar($meta->get_all_overloaded_operators), 2); my $minus_meth = $meta->get_overloaded_operator('-'); isa_ok($minus_meth, 'Class::MOP::Method::Overload'); @@ -94,6 +94,11 @@ BEGIN { $plus_impl = sub { $plus = 1; "plus" } } is($minus, 0); is(Foo::Overloaded->new - Foo::Overloaded->new, "minus"); is($minus, 1); + + $meta->remove_overloaded_operator('-'); + + like(exception { Foo::Overloaded->new - Foo::Overloaded->new }, + qr/Operation "-": no method found/); } done_testing;