Skip to content

Testing

// fragment-only
fn add(a: int, b: int) -> int {
return a + b
}
test add_works {
assert add(2, 3) == 5;
}
fn main(caps: Caps) -> int {
return add(2, 3)
}
Terminal window
vow test tests/lang/add_test.vow

Framework packages expose router_try_dispatch / try_handle for unit tests (no accept loop). Handlers are fn(Request) -> Response; tests assert status codes only.

import lib.router
import lib.request
import lib.response
fn stub(_req: request.Request) -> response.Response {
return response.send(200, "ok")
}
test "route matches" {
let r = router.router_get(router.router_new(), "/health", stub)
assert router.router_try_dispatch(r, "GET /health") == 200
}

See vow-web-server and vow-frameworks/vow-web-server/tests/.