factor/unmaintained/cont-responder/callbacks-tests.factor

68 lines
1.6 KiB
Factor
Raw Normal View History

2008-06-02 16:00:03 -04:00
USING: furnace furnace.actions furnace.callbacks accessors
http http.server http.server.responses tools.test
namespaces io fry sequences
2008-03-11 04:39:09 -04:00
splitting kernel hashtables continuations ;
2008-06-02 16:00:03 -04:00
IN: furnace.callbacks.tests
2008-03-11 04:39:09 -04:00
[ 123 ] [
[
2008-06-02 16:00:03 -04:00
<request> "GET" >>method init-request
2008-03-11 04:39:09 -04:00
[
exit-continuation set
2008-04-25 04:23:47 -04:00
{ }
2008-03-11 17:03:22 -04:00
<action> [ [ "hello" print 123 ] show-final ] >>display
2008-03-11 04:39:09 -04:00
<callback-responder>
call-responder
] callcc1
] with-scope
] unit-test
[
<action> [
[
"hello" print
"text/html" <content>
2008-03-11 04:39:09 -04:00
] show-page
"byebye" print
[ 123 ] show-final
2008-03-11 17:03:22 -04:00
] >>display
2008-03-11 04:39:09 -04:00
<callback-responder> "r" set
[ 123 ] [
2008-06-02 16:00:03 -04:00
<request> init-request
2008-03-11 04:39:09 -04:00
[
exit-continuation set
2008-06-02 16:00:03 -04:00
<request> "GET" >>method init-request
2008-04-25 04:23:47 -04:00
{ } "r" get call-responder
2008-03-11 04:39:09 -04:00
] callcc1
body>> first
<request>
"GET" >>method
2008-06-02 16:00:03 -04:00
dup url>> rot cont-id associate >>query drop
dup url>> "/" >>path drop
init-request
2008-03-11 04:39:09 -04:00
[
exit-continuation set
2008-04-25 04:23:47 -04:00
{ }
2008-03-11 04:39:09 -04:00
"r" get call-responder
] callcc1
! get-post-get
<request>
"GET" >>method
2008-06-02 16:00:03 -04:00
dup url>> rot "location" header query>> >>query drop
dup url>> "/" >>path drop
init-request
2008-03-11 04:39:09 -04:00
[
exit-continuation set
2008-04-25 04:23:47 -04:00
{ }
2008-03-11 04:39:09 -04:00
"r" get call-responder
] callcc1
] unit-test
] with-scope