]> gitweb.factorcode.org Git - factor.git/blob - unmaintained/cont-responder/callbacks-tests.factor
tools.test: Make the flag public. Finish porting tester changes to fuzzer.
[factor.git] / unmaintained / cont-responder / callbacks-tests.factor
1 USING: furnace furnace.actions furnace.callbacks accessors
2 http http.server http.server.responses tools.test
3 namespaces io fry sequences
4 splitting kernel hashtables continuations ;
5 IN: furnace.callbacks.tests
6
7 [ 123 ] [
8     [
9         <request> "GET" >>method init-request
10         [
11             exit-continuation set
12             { }
13             <action> [ [ "hello" print 123 ] show-final ] >>display
14             <callback-responder>
15             call-responder
16         ] callcc1
17     ] with-scope
18 ] unit-test
19
20 [
21     <action> [
22         [
23             "hello" print
24             <html-content>
25         ] show-page
26         "byebye" print
27         [ 123 ] show-final
28     ] >>display
29     <callback-responder> "r" set
30
31     [ 123 ] [
32         <request> init-request
33
34         [
35             exit-continuation set
36             <request> "GET" >>method init-request
37             { } "r" get call-responder
38         ] callcc1
39
40         body>> first
41
42         <request>
43             "GET" >>method
44             dup url>> rot cont-id associate >>query drop
45             dup url>> "/" >>path drop
46         init-request
47
48         [
49             exit-continuation set
50             { }
51             "r" get call-responder
52         ] callcc1
53
54         ! get-post-get
55         <request>
56             "GET" >>method
57             dup url>> rot "location" header query>> >>query drop
58             dup url>> "/" >>path drop
59         init-request
60
61         [
62             exit-continuation set
63             { }
64             "r" get call-responder
65         ] callcc1
66     ] unit-test
67 ] with-scope