Note that there are some explanatory texts on larger screens.

plurals
  1. POHow much do I need to test Moose- and MooseX::FollowPBP-generated methods?
    text
    copied!<p>I want to start strictly doing Test-Driven-Development. However, I was wondering how much I should test methods generated by Moose and MooseX::FollowPBP. For example, I have the following class:</p> <pre><code>package Neu::Series; use Moose; use MooseX::FollowPBP; use File::Find::Wanted; has 'file_regex' =&gt; ( isa=&gt;'RegexpRef', is=&gt;'rw', default =&gt; sub{ qr{ [A-Z] #Uppercase letter [a-zA-Z]* #any letter, any number of times [-] #dash ( #open capturing parenthesis [0-9] [0-9] [0-9] [0-9] [a-zA-Z]? #any letter, optional ) #close capturing parenthesis }xms; }, ); has 'top_dir' =&gt; ( isa=&gt;'Str', is=&gt;'rw', ); has 'access' =&gt;( isa=&gt;'Neu::Access', is=&gt;'ro', required=&gt;1, ); 1; </code></pre> <p>My current test script is:</p> <pre><code>use strict; use warnings; use Test::More tests =&gt; 8; use Neu::Access; BEGIN{ use_ok('Neu::Series'); } can_ok( 'Neu::Series', 'new'); can_ok( 'Neu::Series', 'set_file_regex'); can_ok( 'Neu::Series', 'get_file_regex'); can_ok( 'Neu::Series', 'set_top_dir'); can_ok( 'Neu::Series', 'get_top_dir'); can_ok( 'Neu::Series', 'get_access'); my $access = Neu::Access-&gt;new(dsn =&gt; 'test'); my $series_worker = Neu::Series-&gt;new(access =&gt; $access); isa_ok($series_worker, 'Neu::Series'); </code></pre> <p>Is this enough or too-much testing? (That is, besides the obviously missing tests for the regex).</p> <p>I thought I saw a web page or another post about this somewhere, but I haven't been able to find it today.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload