Re: Anyone want Test::Class::Moose?

Ovid <[email protected]>
Newsgroups gmane.comp.lang.perl.quality-assurance
Message-ID <[email protected]>
Hi Mark,

>________________________________
> From: Mark Stosberg <[email protected]>


>As I looked more at Test::Class::Moose, one thing I really like is that
>plans are completely gone. Thank you.

You're welcome. They're inferred at the suite and class level, but with an implicit "done_testing()" for each method. It's not perfect, but there alternatives seemed a touch worse.

>Two questions:
>
>1. About this: "use Test::Class::Moose;"
>
>Why not standard inheritance to add Test::Class functionality?
>
>It looke the rationale here is to save a line of boilerplate with the
>"use Moose" line.

Test::Class::Moose is explicitly coupled with Moose, so having a "use Moose" line is both redundant and error-prone. If it's required and you forget it, oops. I've given you a source of bugs you didn't need. If it's not required, why write it?

>2.  About this syntax for extending  a test class:
>  use Test::Class::Moose parent => 'TestsFor::Some::Class';
>
>why not use standard inheritance in a class, and to extend a class using
>test::Class? Or could you 'extends' in the import list here to look more
>Moose-y?


I think "extends" might be better. Good call.

I don't use standard inheritance because the various solutions for that don't allow for both inheriting from a class and exporting functions (in this case, ok(), is(), eq_or_diff(), and so on).

Cheers,
Ovid
--
Twitter - http://twitter.com/OvidPerl/
Buy my book - http://bit.ly/beginning_perl
Buy my other book - http://www.oreilly.com/catalog/perlhks/
Live and work overseas - http://www.overseas-exile.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.