From e4eac77887cd9c1dd010057d441691d030a851df Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Wed, 10 Jun 2015 23:14:50 -0300 Subject: content-parser: added "automatic" links --- tests/check_content_parser.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c index d549de9..9b1d318 100644 --- a/tests/check_content_parser.c +++ b/tests/check_content_parser.c @@ -609,13 +609,13 @@ test_content_parse_inline(void **state) { char *html = blogc_content_parse_inline( "**bola***asd* [![lol](http://google.com/lol.png) **lol** " - "\\[asd\\]\\(qwe\\)](http://google.com) ``chunda``"); + "\\[asd\\]\\(qwe\\)](http://google.com) ``chunda`` [[bola]]"); assert_non_null(html); assert_string_equal(html, "bolaasd " " lol [asd](qwe) " - "chunda"); + "chunda bola"); free(html); html = blogc_content_parse_inline("*bola*"); assert_non_null(html); @@ -780,6 +780,36 @@ test_content_parse_inline_link(void **state) } +void +test_content_parse_inline_link_auto(void **state) +{ + char *html = blogc_content_parse_inline("[[guda]]"); + assert_non_null(html); + assert_string_equal(html, "guda"); + free(html); + html = blogc_content_parse_inline("[[guda]]\n"); + assert_non_null(html); + assert_string_equal(html, "guda\n"); + free(html); + html = blogc_content_parse_inline("[[guda]asd]"); + assert_non_null(html); + assert_string_equal(html, "guda"); + free(html); + html = blogc_content_parse_inline("[[guda]asd]\n"); + assert_non_null(html); + assert_string_equal(html, "guda\n"); + free(html); + html = blogc_content_parse_inline("[[guda]asd"); + assert_non_null(html); + assert_string_equal(html, "[[guda]asd"); + free(html); + html = blogc_content_parse_inline("[[guda]asd\n"); + assert_non_null(html); + assert_string_equal(html, "[[guda]asd\n"); + free(html); +} + + void test_content_parse_inline_image(void **state) { @@ -902,6 +932,7 @@ main(void) unit_test(test_content_parse_inline_strong), unit_test(test_content_parse_inline_code), unit_test(test_content_parse_inline_link), + unit_test(test_content_parse_inline_link_auto), unit_test(test_content_parse_inline_image), unit_test(test_content_parse_inline_line_break), }; -- cgit v1.2.3-18-g5258