Initial commit
This commit is contained in:
commit
2f39c58d6c
27 changed files with 2969 additions and 0 deletions
31
tests/non-blocking.scm
Normal file
31
tests/non-blocking.scm
Normal file
|
@ -0,0 +1,31 @@
|
|||
(use-modules (tests)
|
||||
(fibers)
|
||||
(unit-test)
|
||||
(web uri)
|
||||
(web client)
|
||||
(web response)
|
||||
(knots web-server)
|
||||
(knots non-blocking))
|
||||
|
||||
(run-fibers-for-tests
|
||||
(lambda ()
|
||||
(let* ((web-server
|
||||
(run-knots-web-server
|
||||
(lambda (request)
|
||||
(values '((content-type . (text/plain)))
|
||||
"Hello, World!"))
|
||||
#:port 0)) ;; Bind to any port
|
||||
(port
|
||||
(web-server-port web-server))
|
||||
(uri
|
||||
(build-uri 'http #:host "127.0.0.1" #:port port)))
|
||||
|
||||
|
||||
(assert-equal
|
||||
200
|
||||
(response-code
|
||||
(http-get
|
||||
uri
|
||||
#:port (nonblocking-open-socket-for-uri uri)))))))
|
||||
|
||||
(display "non-blocking test finished successfully\n")
|
Loading…
Add table
Add a link
Reference in a new issue