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.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/test-convert-markdown.c b/test-convert-markdown.c
index 403a68a..09a3d18 100644
--- a/test-convert-markdown.c
+++ b/test-convert-markdown.c
@@ -20,14 +20,19 @@ static int test_parse_file(const char* testname, const char* input, const char*
FILE* instream = tmpfile();
FILE* outstream = tmpfile();
- /* for some reason, input isn't properly written to instream */
- fprintf(instream, "%s\n", input);
+ if (instream == NULL || outstream == NULL) {
+ printf("Error opening temporary file(s)");
+ return 1;
+ }
+
+ fprintf(instream, "%s", input);
+ rewind(instream);
const int length = strlen(output) + 1;
char buffer[length];
- /* TODO: use instream instead of stdin */
- _parse_file(stdin, outstream);
+ _parse_file(instream, outstream);
+
const int tmp_length = ftell(outstream) + 1;
rewind(outstream);
@@ -46,11 +51,11 @@ static int test_parse_file(const char* testname, const char* input, const char*
}
int main(void) {
- printf("=============\nRunning Tests\n=============\n");
+ 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*", "<strong>bold</strong>\n");
+ errors += test_parse_file("2. Bold", "**bold**", "<p><strong>bold</strong></p>\n");
printf("\n============\nTest Summary\n============\n");