Ovid/test-class-moose — pull request #10 by pboyd (2013-06-16 21:45:23+00:00)
Title: Tag inheritance 

Kudos on Test::Class::Moose, it seems like the most promising development in Perl testing I've seen in a while.

Tags didn't quite work like I expected though. My set up looked something like this:

package Foo;

sub test_stuff : Tags(blah) {
...
}

package Foo::Subclass;

extends 'Foo';

sub test_other_stuff {
...
}

So then I tried to run the suite while excluding the "blah" tag, and was surprised to find that the Foo::Subclass->test_stuff test ran. In my opinion, if I don't override a method, the parent classes tags should still apply.

So what I propose, and what this patch implements, is that tags should persist to sub-classes when the method isn't overridden. So if a method is overridden, the tags have to specified there. And if it's not overridden the tags from the parent class still apply.

This patch modifies TagRegistry::method_has_tag, to search for the class that actually defines the method, and uses those tags. I didn't modify the other TagRegistry functions, they don't appear to be used anywhere. I don't mind updating them to keep them consistent, but I figured I'd make sure this concept wasn't DOA first.