aboutsummaryrefslogtreecommitdiff
path: root/test-convert-markdown.c
diff options
context:
space:
mode:
Diffstat (limited to 'test-convert-markdown.c')
-rw-r--r--test-convert-markdown.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/test-convert-markdown.c b/test-convert-markdown.c
index 09a3d18..d2eb1a7 100644
--- a/test-convert-markdown.c
+++ b/test-convert-markdown.c
@@ -36,7 +36,12 @@ static int test_parse_file(const char* testname, const char* input, const char*
const int tmp_length = ftell(outstream) + 1;
rewind(outstream);
- fgets(buffer, length, outstream);
+ char* result;
+ size_t len = 0;
+ do {
+ result = fgets(buffer + len, length - len, outstream);
+ len = strlen(buffer);
+ } while (result);
fclose(instream);
fclose(outstream);
@@ -45,7 +50,7 @@ static int test_parse_file(const char* testname, const char* input, const char*
return 0;
} else {
printf("%s test failed\n", testname);
- printf("%s !=\n%s\n", buffer, output);
+ printf("%s\n !=\n%s\n", buffer, output);
return 1;
}
}
@@ -54,8 +59,15 @@ int main(void) {
printf("\n=============\nRunning Tests\n=============\n");
int errors = 0;
- errors += test_parse_file("1. Header", "# header", "<h1 id=\"header\">header</h1>\n");
- errors += test_parse_file("2. Bold", "**bold**", "<p><strong>bold</strong></p>\n");
+ errors += test_parse_file("1. Header",
+ "# header",
+ "<h1 id=\"header\">header</h1>\n");
+ errors += test_parse_file("2. Bold",
+ "**bold**",
+ "<p><strong>bold</strong></p>\n");
+ errors += test_parse_file("3. Multiline",
+ "# header\n`code`",
+ "<h1 id=\"header\">header</h1>\n\n<p><code>code</code></p>\n");
printf("\n============\nTest Summary\n============\n");