<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><div></div><div>I am working through the web server tutorial. I was wondering if there is a way to write tests for functions like parse-post in the code below. It seems like there are two issues to resolve: 1) the scope of parse-post 2) constructing a test binding.</div><div><br></div><div>(define (render-blog-page request)<div> (local [(define (response-generator make-url)</div><div> `(html (head (title "My Blog"))</div><div> (body</div><div> (h1 "My Blog")</div><div> ,(render-posts make-url)</div><div>
(form ((action</div><div> ,(make-url insert-post-handler)))</div><div> (input ((name "title")))</div><div> (input ((name "body")))</div><div> (input ((type "submit")))))))</div><div> </div><div> (define (parse-post bindings)</div><div> (make-post (extract-binding/single 'title' bindings)</div><div>
(extract-binding/single 'body' bindings)))</div><div> </div><div> (define (insert-post-handler request)</div><div> (blog-insert-post!</div><div> BLOG (parse-post (request-bindings request)))</div><div> (render-blog-page request))]</div><div> </div><div> (send/suspend/dispatch response-generator)))</div><div><br></div> </div>Scott Hickey<br>Senior Consultant<br>Object Partners, Inc.<div><br></div><div style="position:fixed"></div></div></body></html>