feat(lexer): header, line breaks, paragraph breaks
This commit is contained in:
parent
a6c17eff5f
commit
f003e3555b
5 changed files with 1974 additions and 13 deletions
27
test/lexer/lexer.c
Normal file
27
test/lexer/lexer.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include "test.h"
|
||||
|
||||
#include "mrk/lexer.h"
|
||||
|
||||
#define LEXER_INIT() \
|
||||
mrk_lexer *lxr; \
|
||||
TEST_CHECK(mrk_lexer_init(&lxr) == mrk_err_ok)
|
||||
|
||||
void test_lexer_header() {
|
||||
LEXER_INIT();
|
||||
|
||||
const char *buf = "#### hallo";
|
||||
mrk_lexer_open(lxr, buf, 0);
|
||||
|
||||
mrk_token t;
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_header);
|
||||
TEST_CHECK_(t.start == 0, "t.start == %lu", t.start);
|
||||
TEST_CHECK(t.end == 4);
|
||||
|
||||
mrk_lexer_free(lxr);
|
||||
}
|
||||
|
||||
TEST_LIST = {
|
||||
{ "lexer header", test_lexer_header },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
1839
test/test.h
Normal file
1839
test/test.h
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue