mrk/test/parser/compound.c

34 lines
871 B
C
Raw Permalink Normal View History

#include "test.h"
#include "mrk/lexer.h"
#include "mrk/parser.h"
#define LEXER_INIT() \
mrk_lexer *lxr; \
TEST_CHECK(mrk_lexer_init(&lxr) == mrk_err_ok)
#define PARSER_INIT() \
mrk_parser *parser; \
TEST_CHECK(mrk_parser_init(&parser) == mrk_err_ok)
#define PARSER_OPEN(buf) \
mrk_lexer *lxr; \
TEST_CHECK(mrk_lexer_init(&lxr) == mrk_err_ok); \
mrk_parser *parser; \
TEST_CHECK(mrk_parser_init(&parser) == mrk_err_ok); \
mrk_lexer_open(lxr, buf, 0); \
mrk_parser_open(parser, lxr)
void test_parse_simple_header_paragraph() {
const char *buf = "# this is a header\n\nthis is a paragraph with a [link](https://example.com)";
PARSER_OPEN(buf);
mrk_ast_node *root;
TEST_CHECK(mrk_parser_parse(&root, parser) == mrk_err_ok);
}
TEST_LIST = {
{ "parser simple header and paragraph", test_parse_simple_header_paragraph },
{ NULL, NULL }
};