diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-11-15 20:44:13 -0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-11-15 20:44:13 -0200 |
commit | f31e60aa815cc38f36fee4ea664efbd631329172 (patch) | |
tree | d2ed19a5845a36d3428e40a1f4c9a00222399fa3 /tests | |
parent | 19592a65f3e5f6600175271e4499281e66c07976 (diff) | |
download | blogc-f31e60aa815cc38f36fee4ea664efbd631329172.tar.gz blogc-f31e60aa815cc38f36fee4ea664efbd631329172.tar.bz2 blogc-f31e60aa815cc38f36fee4ea664efbd631329172.zip |
content-parser: fixed multiple directive calls in same source
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check_content_parser.c | 319 |
1 files changed, 319 insertions, 0 deletions
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 @@ -1238,6 +1238,325 @@ test_content_parse_directive(void **state) 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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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, + "<h1 id=\"foo\">foo</h1>\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); html = blogc_content_parse( |