factor/basis/furnace/furnace-tests.factor

43 lines
1.2 KiB
Factor
Raw Normal View History

2008-09-22 18:15:59 -04:00
USING: http http.server.dispatchers http.server.responses
2008-11-24 21:26:11 -05:00
http.server furnace furnace.utilities tools.test kernel
2009-02-09 17:46:02 -05:00
namespaces accessors io.streams.string urls xml.writer ;
IN: furnace.tests
2008-06-02 16:00:03 -04:00
TUPLE: funny-dispatcher < dispatcher ;
2009-03-23 01:34:02 -04:00
: <funny-dispatcher> ( -- dispatcher ) funny-dispatcher new-dispatcher ;
2008-06-02 16:00:03 -04:00
TUPLE: base-path-check-responder ;
C: <base-path-check-responder> base-path-check-responder
M: base-path-check-responder call-responder*
2drop
"$funny-dispatcher" resolve-base-path
"text/plain" <content> ;
[ ] [
<dispatcher>
<dispatcher>
<funny-dispatcher>
<base-path-check-responder> "c" add-responder
"b" add-responder
"a" add-responder
main-responder set
] unit-test
[ "/a/b/" ] [
V{ } responder-nesting set
"a/b/c" split-path main-responder get call-responder body>>
] unit-test
[ "<input type=\"hidden\" value=\"&amp;&amp;&amp;\" name=\"foo\"/>" ]
2009-02-09 17:46:02 -05:00
[ "&&&" "foo" hidden-form-field xml>string ]
unit-test
2008-09-22 18:15:59 -04:00
[ f ] [ <request> request [ referrer ] with-variable ] unit-test
[ t ] [ URL" http://foo" dup url [ same-host? ] with-variable ] unit-test
[ f ] [ f URL" http://foo" url [ same-host? ] with-variable ] unit-test