Fix unit tests

db4
Slava Pestov 2008-02-10 03:12:44 -06:00
parent d8edd7b0d4
commit 3eda26ca0b
3 changed files with 10 additions and 25 deletions

7
extra/http/server/server-tests.factor Normal file → Executable file
View File

@ -1,15 +1,12 @@
USING: webapps.file http.server.responders http
http.server namespaces io tools.test strings io.server ;
http.server namespaces io tools.test strings io.server
logging ;
IN: temporary
[ ] [ f [ "404 not found" httpd-error ] with-logging ] unit-test
[ "inspect/global" ] [ "/inspect/global" trim-/ ] unit-test
[ ] [
f [ "unit/test" log-responder ] with-logging
] unit-test
[ "index.html" ]
[ "http://www.jedit.org/index.html" url>path ] unit-test

View File

@ -6,7 +6,7 @@ USING: kernel io io.timeouts continuations ;
TUPLE: null-stream ;
M: null-stream dispose drop ;
M: null-stream set-timeout drop ;
M: null-stream set-timeout 2drop ;
M: null-stream stream-readln drop f ;
M: null-stream stream-read1 drop f ;
M: null-stream stream-read-until 2drop f f ;

View File

@ -1,5 +1,5 @@
USING: smtp tools.test io.streams.string threads
smtp.server kernel sequences namespaces ;
smtp.server kernel sequences namespaces logging ;
IN: temporary
{ 0 0 } [ [ ] with-smtp-connection ] must-infer-as
@ -15,34 +15,22 @@ IN: temporary
{ "hello" "world" } [ send-body ] string-out
] unit-test
[
[
"500 syntax error" check-response
] with-log-stdio
] must-fail
[ "500 syntax error" check-response ] must-fail
[ ] [
[
"220 success" check-response
] with-log-stdio
] unit-test
[ ] [ "220 success" check-response ] unit-test
[ "220 success" ] [
"220 success" [ receive-response ] string-in
] unit-test
[ "220 the end" ] [
[
"220-a multiline response\r\n250-another line\r\n220 the end"
[ receive-response ] string-in
] with-log-stdio
"220-a multiline response\r\n250-another line\r\n220 the end"
[ receive-response ] string-in
] unit-test
[ ] [
[
"220-a multiline response\r\n250-another line\r\n220 the end"
[ get-ok ] string-in
] with-log-stdio
"220-a multiline response\r\n250-another line\r\n220 the end"
[ get-ok ] string-in
] unit-test
[