/* * blogc: A blog compiler. * Copyright (C) 2015 Rafael G. Martins * * This program can be distributed under the terms of the BSD License. * See the file COPYING. */ #ifdef HAVE_CONFIG_H #include #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include "../src/content-parser.h" #include "../src/error.h" #include "../src/utils/utils.h" static void test_content_parse(void **state) { const char *a = "# um\n" "## dois\n" "### tres\n" "#### quatro\n" "##### cinco\n" "###### seis\n" "\n" "bola\n" "chunda\n" "\n" "> bola\n" "> guda\n" "> buga\n" "> \n" "> asd\n" "\n" " bola\n" " asd\n" " qwewer\n" "\n" "\n" "\n" "guda\n" "yay"; blogc_error_t *err = NULL; char *html = blogc_content_parse(a, strlen(a), &err); assert_null(err); assert_non_null(html); assert_string_equal(html, "

um

\n" "

dois

\n" "

tres

\n" "

quatro

\n" "
cinco
\n" "
seis
\n" "

bola\n" "chunda

\n" "

bola\n" "guda\n" "buga

\n" "
asd
\n" "
\n" "
bola\n"
        " asd\n"
        "qwewer
\n" "\n" "

guda\n" "yay

\n"); free(html); } int main(void) { const UnitTest tests[] = { unit_test(test_content_parse), }; return run_tests(tests); }