mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 03:05:29 -05:00
more tests, including a small sse count
This commit is contained in:
parent
c8982c8836
commit
ed4c731523
4 changed files with 53 additions and 0 deletions
20
tests/dune
Normal file
20
tests/dune
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
(rule
|
||||
(targets echo1.out)
|
||||
(deps (:bin ../examples/echo.exe))
|
||||
(locks /port)
|
||||
(action (with-stdout-to %{targets} (run ./echo1.sh %{bin}))))
|
||||
|
||||
(rule
|
||||
(alias runtest)
|
||||
(action (diff echo1.expect echo1.out)))
|
||||
|
||||
(rule
|
||||
(targets sse_count.out)
|
||||
(deps (:bin ../examples/sse_server.exe))
|
||||
(locks /port)
|
||||
(action (with-stdout-to %{targets} (run ./sse_count.sh %{bin}))))
|
||||
|
||||
(rule
|
||||
(alias runtest)
|
||||
(action (diff sse_count.expect sse_count.out)))
|
||||
23
tests/sse_count.expect
Normal file
23
tests/sse_count.expect
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
listening on http://localhost:8083/
|
||||
data: 0
|
||||
|
||||
data: 1
|
||||
|
||||
data: 2
|
||||
|
||||
data: 3
|
||||
|
||||
data: 4
|
||||
|
||||
data: 5
|
||||
|
||||
data: 6
|
||||
|
||||
data: 7
|
||||
|
||||
data: 8
|
||||
|
||||
data: 9
|
||||
|
||||
data: 10
|
||||
|
||||
9
tests/sse_count.sh
Executable file
9
tests/sse_count.sh
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
SSE_SERVER=$1
|
||||
|
||||
"$SSE_SERVER" -p 8083 &
|
||||
sleep 0.1
|
||||
|
||||
curl -N 'http://localhost:8083/count/10' -H user-agent:test
|
||||
kill %1
|
||||
|
|
@ -15,6 +15,7 @@ depends: [
|
|||
"ocaml" { >= "4.04.0" }
|
||||
"odoc" {with-doc}
|
||||
"qtest" { >= "2.9" & with-test}
|
||||
"conf-curl" {with-test}
|
||||
"qcheck" {with-test & >= "0.9" }
|
||||
"ounit2" {with-test}
|
||||
"ptime" {with-test}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue