Make tests work on Windows

This commit is contained in:
Tzu-ping Chung 2014-10-22 13:06:26 +08:00
parent a88343c593
commit 9585febb58
2 changed files with 10 additions and 6 deletions

View file

@ -34,3 +34,8 @@ clean:
.c.obj: .c.obj:
$(CC) $(CFLAGS) /c $< /Fo$@ $(CC) $(CFLAGS) /c $< /Fo$@
# Testing
test: hoedown.exe
python test\runner.py

View file

@ -49,19 +49,18 @@ def _test_func(test_case):
HOEDOWN + flags + [os.path.join(TEST_ROOT, test_case['input'])], HOEDOWN + flags + [os.path.join(TEST_ROOT, test_case['input'])],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
) )
hoedown_proc.wait() stdoutdata = hoedown_proc.communicate()[0]
got_tidy_proc = subprocess.Popen( got_tidy_proc = subprocess.Popen(
TIDY, stdin=hoedown_proc.stdout, stdout=subprocess.PIPE, TIDY, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
) )
got_tidy_proc.wait() got = got_tidy_proc.communicate(input=stdoutdata)[0].strip()
got = got_tidy_proc.stdout.read().strip()
expected_tidy_proc = subprocess.Popen( expected_tidy_proc = subprocess.Popen(
TIDY + [os.path.join(TEST_ROOT, test_case['output'])], TIDY + [os.path.join(TEST_ROOT, test_case['output'])],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
) )
expected_tidy_proc.wait() expected = expected_tidy_proc.communicate()[0].strip()
expected = expected_tidy_proc.stdout.read().strip()
# Cleanup. # Cleanup.
hoedown_proc.stdout.close() hoedown_proc.stdout.close()