On 7/29/06, <b class="gmail_sendername">Ryan Culpepper</b> <<a href="mailto:ryan_sml@yahoo.com">ryan_sml@yahoo.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
--- Christopher Armstrong <<a href="mailto:radix@twistedmatrix.com">radix@twistedmatrix.com</a>> wrote:<br>This kind of problem is not the responsibility of the testing<br>framework. You can use the standard abstraction mechanisms of Scheme
<br>(procedures and macros) to factor out common patterns in the test<br>cases. Here are two ideas:</blockquote><div><br>Well, I'm not really sure how it's any less the responsibility of the unit testing framework than, say, :before and :after, or (before) (after) and (around), as they can all be implemented in terms of test cases.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">1) Factor out the creation of the output port and the extraction of<br>the output as bytes into a procedure:
</blockquote><div><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">...</blockquote><div> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2) You could write a macro that produced the test case from just the<br>parts that change:</blockquote><div><br>I don't think either of these are the ideal abstraction level. It's a tradeoff between wanting a terse syntax for defining the tests vs the necessity to write lots of more-specific-than-ideal harness code that may not be used very often; if I had a way to just specify a bindings list to re-evaluate around every test case, that'd be a beautiful compromise.
<br></div></div><br>I'm going to go for a while just functionally separating out stuff like that, but I think eventually I'll end up writing a macro that does the let-bindings.<br><br><br>-- <br>Christopher Armstrong<br>International Man of Twistery
<br><a href="http://radix.twistedmatrix.com/">http://radix.twistedmatrix.com/</a><br><a href="http://twistedmatrix.com/">http://twistedmatrix.com/</a><br><a href="http://canonical.com/">http://canonical.com/</a><br>