Testing
Use case: assert a pure helper
Section titled “Use case: assert a pure helper”// fragment-onlyfn 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)}vow test tests/lang/add_test.vowUse case: router without I/O
Section titled “Use case: router without I/O”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.routerimport lib.requestimport 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/.