chore(parser): change header test

main
Jef Roosens 2024-03-15 22:03:39 +01:00
parent 812d6a0733
commit 06a9d1e37f
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 10 additions and 4 deletions

View File

@ -24,12 +24,18 @@ void test_parse_header() {
const char *buf = "### hello world";
PARSER_OPEN(buf);
mrk_ast_node *root;
TEST_CHECK(mrk_parser_parse(&root, parser) == mrk_err_ok);
mrk_ast_node *header;
mrk_ast_node_init(&header);
TEST_CHECK(mrk_parser_parse_header(header, parser) == mrk_err_ok);
mrk_ast_node *header = root->children.arr[0];
TEST_CHECK(header->type == mrk_ast_node_type_header);
TEST_CHECK(header->children.arr[0]->type == mrk_ast_node_type_text);
TEST_CHECK(header->d.header.depth == 3);
TEST_CHECK(header->children.len == 1);
mrk_ast_node *header_text = header->children.arr[0];
TEST_CHECK(header_text->type == mrk_ast_node_type_text);
TEST_CHECK(header_text->d.text.start == 3);
TEST_CHECK(header_text->d.text.end == 15);
}
void test_parse_link() {