renaming: contain? -> any?, deep-contains? -> deep-any?, pad-left -> pad-head, pad...
[factor/jcg.git] / unmaintained / cont-responder / callbacks-tests.factor
blobdb6f43c5155760759bcb595c2b1214d6cf97ac2b
1 USING: furnace furnace.actions furnace.callbacks accessors\r
2 http http.server http.server.responses tools.test\r
3 namespaces io fry sequences\r
4 splitting kernel hashtables continuations ;\r
5 IN: furnace.callbacks.tests\r
6 \r
7 [ 123 ] [\r
8     [\r
9         <request> "GET" >>method init-request\r
10         [\r
11             exit-continuation set\r
12             { }\r
13             <action> [ [ "hello" print 123 ] show-final ] >>display\r
14             <callback-responder>\r
15             call-responder\r
16         ] callcc1\r
17     ] with-scope\r
18 ] unit-test\r
20 [\r
21     <action> [\r
22         [\r
23             "hello" print\r
24             "text/html" <content>\r
25         ] show-page\r
26         "byebye" print\r
27         [ 123 ] show-final\r
28     ] >>display\r
29     <callback-responder> "r" set\r
31     [ 123 ] [\r
32         <request> init-request\r
34         [\r
35             exit-continuation set\r
36             <request> "GET" >>method init-request\r
37             { } "r" get call-responder\r
38         ] callcc1\r
40         body>> first\r
42         <request>\r
43             "GET" >>method\r
44             dup url>> rot cont-id associate >>query drop\r
45             dup url>> "/" >>path drop\r
46         init-request\r
48         [\r
49             exit-continuation set\r
50             { }\r
51             "r" get call-responder\r
52         ] callcc1\r
54         ! get-post-get\r
55         <request>\r
56             "GET" >>method\r
57             dup url>> rot "location" header query>> >>query drop\r
58             dup url>> "/" >>path drop\r
59         init-request\r
61         [\r
62             exit-continuation set\r
63             { }\r
64             "r" get call-responder\r
65         ] callcc1\r
66     ] unit-test\r
67 ] with-scope\r