]> gitweb.factorcode.org Git - factor.git/blob - basis/furnace/actions/actions-tests.factor
b5a8c6351cc9e32081c8bc417f84857f946a14fc
[factor.git] / basis / furnace / actions / actions-tests.factor
1 USING: kernel furnace.actions io.crlf validators tools.test math math.parser
2 multiline namespaces http io.streams.string http.server http.server.requests
3 sequences splitting accessors ;
4 IN: furnace.actions.tests
5
6 <action>
7     [ "a" param "b" param [ string>number ] bi@ + ] >>display
8 "action-1" set
9
10 STRING: action-request-test-1
11 GET http://foo/bar?a=12&b=13 HTTP/1.1
12
13 blah
14 ;
15
16 [ 25 ] [
17     action-request-test-1 lf>crlf
18     [ read-request ] with-string-reader
19     init-request
20     { } "action-1" get call-responder
21 ] unit-test
22
23 <action>
24     "a" >>rest
25     [ "a" param string>number sq ] >>display
26 "action-2" set
27
28 STRING: action-request-test-2
29 GET http://foo/bar/123 HTTP/1.1
30
31 blah
32 ;
33
34 [ 25 ] [
35     action-request-test-2 lf>crlf
36     [ read-request ] with-string-reader
37     init-request
38     { "5" } "action-2" get call-responder
39 ] unit-test