From 9d484725cf9874ff3f34c61af5f57f6b92e05c00 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Mon, 4 May 2015 05:40:53 -0300 Subject: started implementint a markdown-like syntax for content --- tests/check_content_parser.c | 90 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 tests/check_content_parser.c (limited to 'tests/check_content_parser.c') diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c new file mode 100644 index 0000000..86ba8d8 --- /dev/null +++ b/tests/check_content_parser.c @@ -0,0 +1,90 @@ +/* + * 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); +} -- cgit v1.2.3-18-g5258