test(parser): started some tests
This commit is contained in:
parent
a4a41b287e
commit
184cc79a4c
5 changed files with 66 additions and 7 deletions
|
|
@ -9,7 +9,7 @@
|
|||
void test_lexer_header() {
|
||||
LEXER_INIT();
|
||||
|
||||
const char *buf = "#### hallo";
|
||||
const char *buf = "#### hallo hallo";
|
||||
mrk_lexer_open(lxr, buf, 0);
|
||||
|
||||
mrk_token t;
|
||||
|
|
@ -18,6 +18,11 @@ void test_lexer_header() {
|
|||
TEST_CHECK_(t.start == 0, "t.start == %lu", t.start);
|
||||
TEST_CHECK(t.end == 4);
|
||||
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_text);
|
||||
TEST_CHECK_(t.start == 4, "t.start == %lu", t.start);
|
||||
TEST_CHECK(t.end == 16);
|
||||
|
||||
mrk_lexer_free(lxr);
|
||||
}
|
||||
|
||||
|
|
@ -56,9 +61,7 @@ void test_lexer_simple1() {
|
|||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_text);
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_newline);
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_newline);
|
||||
TEST_CHECK(t.type == mrk_token_type_blank_line);
|
||||
TEST_CHECK(mrk_lexer_next(&t, lxr) == mrk_lexer_err_ok);
|
||||
TEST_CHECK(t.type == mrk_token_type_text);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue