aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2015-05-29 19:50:02 -0300
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2015-05-29 19:50:02 -0300
commit7e7ff1b9f109b1c06f660030221c53b3ad309c3f (patch)
treeeda82fbbb487b0888b0507359269d54f510226ec /tests
parent4e6925a1a6f4d2be145d02f1a08553d7d8fd2624 (diff)
downloadblogc-7e7ff1b9f109b1c06f660030221c53b3ad309c3f.tar.gz
blogc-7e7ff1b9f109b1c06f660030221c53b3ad309c3f.tar.bz2
blogc-7e7ff1b9f109b1c06f660030221c53b3ad309c3f.zip
content-parser: fixed inline parser
Diffstat (limited to 'tests')
-rw-r--r--tests/check_content_parser.c70
1 files changed, 66 insertions, 4 deletions
diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c
index 9ed8a0e..d549de9 100644
--- a/tests/check_content_parser.c
+++ b/tests/check_content_parser.c
@@ -749,10 +749,33 @@ test_content_parse_inline_link(void **state)
assert_non_null(html);
assert_string_equal(html, "<a href=\"\nhttp://example.org/\">bola</a>\n");
free(html);
- // invalid
html = blogc_content_parse_inline("[bola](http://example.org/\n");
assert_non_null(html);
- assert_string_equal(html, ""); // FIXME
+ assert_string_equal(html, "[bola](http:&#x2F;&#x2F;example.org&#x2F;\n");
+ free(html);
+ html = blogc_content_parse_inline("[");
+ assert_non_null(html);
+ assert_string_equal(html, "[");
+ free(html);
+ html = blogc_content_parse_inline("[\n");
+ assert_non_null(html);
+ assert_string_equal(html, "[\n");
+ free(html);
+ html = blogc_content_parse_inline("[a");
+ assert_non_null(html);
+ assert_string_equal(html, "[a");
+ free(html);
+ html = blogc_content_parse_inline("[a\n");
+ assert_non_null(html);
+ assert_string_equal(html, "[a\n");
+ free(html);
+ html = blogc_content_parse_inline("[a]");
+ assert_non_null(html);
+ assert_string_equal(html, "[a]");
+ free(html);
+ html = blogc_content_parse_inline("[a]\n");
+ assert_non_null(html);
+ assert_string_equal(html, "[a]\n");
free(html);
}
@@ -781,10 +804,49 @@ test_content_parse_inline_image(void **state)
assert_non_null(html);
assert_string_equal(html, "<img src=\"\nhttp://example.org/\" alt=\"bola\">\n");
free(html);
- // invalid
html = blogc_content_parse_inline("![bola](http://example.org/\n");
assert_non_null(html);
- assert_string_equal(html, ""); // FIXME
+ assert_string_equal(html, "![bola](http:&#x2F;&#x2F;example.org&#x2F;\n");
+ free(html);
+ html = blogc_content_parse_inline("!");
+ assert_non_null(html);
+ assert_string_equal(html, "!");
+ free(html);
+ html = blogc_content_parse_inline("![");
+ assert_non_null(html);
+ assert_string_equal(html, "![");
+ free(html);
+ html = blogc_content_parse_inline("!\n");
+ assert_non_null(html);
+ assert_string_equal(html, "!\n");
+ free(html);
+ html = blogc_content_parse_inline("![\n");
+ assert_non_null(html);
+ assert_string_equal(html, "![\n");
+ free(html);
+ html = blogc_content_parse_inline("![a");
+ assert_non_null(html);
+ assert_string_equal(html, "![a");
+ free(html);
+ html = blogc_content_parse_inline("!a\n");
+ assert_non_null(html);
+ assert_string_equal(html, "!a\n");
+ free(html);
+ html = blogc_content_parse_inline("![a\n");
+ assert_non_null(html);
+ assert_string_equal(html, "![a\n");
+ free(html);
+ html = blogc_content_parse_inline("![a]");
+ assert_non_null(html);
+ assert_string_equal(html, "![a]");
+ free(html);
+ html = blogc_content_parse_inline("!a]\n");
+ assert_non_null(html);
+ assert_string_equal(html, "!a]\n");
+ free(html);
+ html = blogc_content_parse_inline("![a]\n");
+ assert_non_null(html);
+ assert_string_equal(html, "![a]\n");
free(html);
}