test(routing): add star matching test
parent
115bf74456
commit
6eb965adcd
|
@ -41,7 +41,20 @@ void test_routing_simple() {
|
||||||
lnm_http_router_free(router);
|
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 = {
|
TEST_LIST = {
|
||||||
{ "routing simple", test_routing_simple },
|
{ "routing simple", test_routing_simple },
|
||||||
|
{ "routing star", test_routing_star },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue