diff --git a/test/routing.c b/test/routing.c index e18b695..e133f4b 100644 --- a/test/routing.c +++ b/test/routing.c @@ -41,7 +41,20 @@ void test_routing_simple() { lnm_http_router_free(router); } +void test_routing_star() { + lnm_http_router *router; + TEST_CHECK(lnm_http_router_init(&router) == lnm_err_ok); + + TEST_CHECK(lnm_http_router_add(NULL, router, lnm_http_method_get, "/*key") == lnm_err_ok); + + lnm_http_route_match match; + TEST_CHECK(lnm_http_router_route(&match, router, lnm_http_method_get, "/hello/world") == lnm_http_route_err_match); + TEST_CHECK(match.key_segments[0].start == 1); + TEST_CHECK(match.key_segments[0].len == 11); +} + TEST_LIST = { { "routing simple", test_routing_simple }, + { "routing star", test_routing_star }, { NULL, NULL } };