refactor(routing): simply key segment api
This commit is contained in:
parent
9dbdb0b089
commit
d739157fb1
3 changed files with 15 additions and 19 deletions
|
|
@ -29,12 +29,12 @@ void test_routing_simple() {
|
|||
TEST_CHECK(match.key_segments[1].start == 15);
|
||||
TEST_CHECK(match.key_segments[1].len == 9);
|
||||
|
||||
lnm_http_route_match_segment *segment;
|
||||
TEST_CHECK(lnm_http_route_match_get(&segment, &match, "second") == lnm_err_ok);
|
||||
const lnm_http_route_match_segment *segment;
|
||||
TEST_CHECK((segment = lnm_http_route_match_get(&match, "second")) != NULL);
|
||||
TEST_CHECK(segment->start == 15);
|
||||
TEST_CHECK(segment->len == 9);
|
||||
TEST_CHECK(lnm_http_route_match_get(&segment, &match, "yuhh") == lnm_err_not_found);
|
||||
TEST_CHECK(lnm_http_route_match_get(&segment, &match, "hello") == lnm_err_ok);
|
||||
TEST_CHECK((segment = lnm_http_route_match_get(&match, "yuhh")) == NULL);
|
||||
TEST_CHECK((segment = lnm_http_route_match_get(&match, "hello")) != NULL);
|
||||
TEST_CHECK(segment->start == 6);
|
||||
TEST_CHECK(segment->len == 8);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue