(I hope this is the right place to ask this question; I haven't found any more appropriate forums specific to SchemeUnit).<br><br>Say I have a test suite like this:<br><br><span style="font-family: courier new,monospace;">
(test-suite</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> "amplify-alist"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (test-equal? "Basic two element pair list" </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
(let ([port (open-output-bytes)])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (amplify-alist '((#"hi" . #"there") (#"_command" . #"something")) port)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (get-output-bytes port))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
#"\x00\x02hi\x00\5there\x00\x08_command\x00\x09something\x00\x00")</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
(test-equal? "Empty list" </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (let ([port (open-output-bytes)])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> (amplify-alist () port)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> (get-output-bytes port))
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> #"\x00\x00"))</span><br><br><br>The duplication of the definition of `port' is unfortunate, and I'd like to unify it. I was expecting to be able to do this with before and after thunks, but since (AFAICT) they're not executed lexically around the test cases that are run, they can't help here. #:before and #:after seem only useful for their side-effects (at least the examples in the documentation indicate that), and similar for (before) (after) and (around).
<br><br>Perhaps I'm thinking about this the wrong way or missing something obvious, because it amazes me that SchemeUnit doesn't have anything to facilitate this case. I think what I was expecting is to be able to specify something like a bindings list that would be evaluated around all tests in a suite.
<br><br>If this example seems trivial, I have much worse ones; this one serves as a simple demonstration of my problem.<br><br>Thanks for any help.<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><br>