<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Others have answered about /how/ you may test unexported<br>
functions, so I thought I'd chip in to ask you /why/ you<br>
would want to?<br>
</blockquote><div><br>To see if they're working.  Just because something's internal doesn't mean it doesn't need to be verified.  I mean I understand and respect the perspective that what's exported is the determinant and the important part of a module; at the same time, testing is about making sure I got my stuff right, and errors and defects are just as likely in private code as they are in public.<br>
<br>Practically speaking, many tests aren't viable if they have to be dispatched upstream.  In particular, testing something to make sure it behaves correctly with malformed data is nearly impossible if you're only feeding it data from your normal upstream code.<br>
<br>Yes, there's something to be said for tests that only mimic real world circumstances, but there's also something to be said for exhaustive testing, and something which is limited to the currently realistic set of circumstances and causations is anything but exhaustive.  Code sensibly.  Test paranoiacally.<br>
<br>Anyway, it's an opinion.<br><br><br><br>    - John<br><br><br><br></div></div>------<br>GuaranteedVPS.com - bandwidth commitments and root starting from $12.98/mo