Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^6: Writing tests when you don't know what the output should be

by nysus (Parson)
on May 18, 2016 at 03:54 UTC ( [id://1163289]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Writing tests when you don't know what the output should be
in thread Writing tests when you don't know what the output should be

Thanks for this. Can you please help me understand why you used an internal and external accessor for dir? I'm new to Moose and I'm not quite sure why you did that. Thanks.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re^7: Writing tests when you don't know what the output should be
by choroba (Cardinal) on May 18, 2016 at 08:57 UTC
    It depends on what you want. My solution expects the user only wants to supply the directory name and doesn't care about the internal implementation. It locks in a dependency, though, so another approach would be to accept just an object with a defined interface (dependency injection) - it's easier to test and extend.

    You should start with a picture, define the behaviours of the objects, and the implementation should emerge from the design, not vice versa.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1163289]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-16 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found