From f31e60aa815cc38f36fee4ea664efbd631329172 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sun, 15 Nov 2015 20:44:13 -0200 Subject: content-parser: fixed multiple directive calls in same source --- tests/check_content_parser.c | 319 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 319 insertions(+) (limited to 'tests/check_content_parser.c') diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c index dfb1ffb..86ff1d0 100644 --- a/tests/check_content_parser.c +++ b/tests/check_content_parser.c @@ -1237,6 +1237,325 @@ test_content_parse_directive(void **state) "

bola

\r\n"); free(html); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 0); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 0); + html = blogc_content_parse( + "# foo\n" + "\n" + ".. bola::\n" + "\n" + ".. bola::", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, 0); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, 0); + html = blogc_content_parse( + "# foo\n" + "\n" + ".. bola:: asd\n" + "\n" + ".. bola:: asd\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 0); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 0); + html = blogc_content_parse( + "# foo\r\n" + "\r\n" + ".. bola::\r\n" + "\r\n" + ".. bola::\r\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\r\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 1); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 0); + html = blogc_content_parse( + "# foo\n" + "\n" + ".. bola::\n" + " :asd: qwe\n" + "\n" + ".. bola::", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, 1); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, 0); + html = blogc_content_parse( + "# foo\n" + "\n" + ".. bola:: asd\n" + " :asd: qwe\n" + "\n" + ".. bola:: asd\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 1); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 0); + html = blogc_content_parse( + "# foo\n" + "\n" + ".. bola::\n" + " :asd: qwe\n" + "\n" + ".. bola::\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 1); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 0); + html = blogc_content_parse( + "# foo\r\n" + "\r\n" + ".. bola::\r\n" + " :asd: qwe\r\n" + "\r\n" + ".. bola::\r\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\r\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 1); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 1); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "zxc"); + html = blogc_content_parse( + "# foo\n" + "\n" + ".. bola::\n" + " :asd: qwe\n" + "\n" + ".. bola::\n" + " :asd: zxc\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 1); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 1); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "zxc"); + html = blogc_content_parse( + "# foo\r\n" + "\r\n" + ".. bola::\r\n" + " :asd: qwe\r\n" + "\r\n" + ".. bola::\r\n" + " :asd: zxc\r\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\r\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 2); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "123"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 2); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "456"); + html = blogc_content_parse( + "# foo\n" + "\n" + ".. bola::\n" + " :asd: qwe\n" + " :qwe: 123\n" + "\n" + ".. bola::\n" + " :asd: qwe\n" + " :qwe: 456", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, 2); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "123"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, 2); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "456"); + html = blogc_content_parse( + "# foo\n" + "\n" + ".. bola:: asd\n" + " :asd: qwe\n" + " :qwe: 123\n" + "\n" + ".. bola:: asd\n" + " :asd: qwe\n" + " :qwe: 456\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 2); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "123"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 2); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "456"); + html = blogc_content_parse( + "# foo\n" + "\n" + ".. bola::\n" + " :asd: qwe\n" + " :qwe: 123\n" + "\n" + ".. bola::\n" + " :asd: qwe\n" + " :qwe: 456\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 2); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "123"); + will_return(__wrap_blogc_directive_loader, "bola"); + will_return(__wrap_blogc_directive_loader, NULL); + will_return(__wrap_blogc_directive_loader, 2); + will_return(__wrap_blogc_directive_loader, "asd"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "qwe"); + will_return(__wrap_blogc_directive_loader, "456"); + html = blogc_content_parse( + "# foo\r\n" + "\r\n" + ".. bola::\r\n" + " :asd: qwe\r\n" + " :qwe: 123\r\n" + "\r\n" + ".. bola::\r\n" + " :asd: qwe\r\n" + " :qwe: 456\r\n", NULL); + assert_non_null(html); + assert_string_equal(html, + "

foo

\r\n" + "CHUNDA\n" + "CHUNDA\n"); + free(html); + will_return(__wrap_blogc_directive_loader, "bola"); will_return(__wrap_blogc_directive_loader, "chunda"); will_return(__wrap_blogc_directive_loader, 0); -- cgit v1.2.3-18-g5258