md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
git clone https://noulin.net/git/md4c.git
Log | Files | Refs | README | LICENSE

commit 938460d564d7367ec969f015eb341164f438e780
parent c52a50a3dbe065da5a428cd5c51fec005e29d314
Author: Martin Mitas <mity@morous.org>
Date:   Mon, 24 Jul 2017 21:17:53 +0200

Improve/unify output of test scripts.

Diffstat:
Mscripts/run-tests.sh | 29++++++++++++++++++++++-------
Mtest/pathological_tests.py | 4++--
2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh @@ -16,27 +16,42 @@ if [ ! -x "$PROGRAM" ]; then exit 1 fi -if which python3 2>/dev/null; then +if which python3 >>/dev/null 2>&1; then PYTHON=python3 -elif which python 2>/dev/null; then +elif which python >>/dev/null 2>&1; then if [ `python --version | awk '{print $2}' | cut -d. -f1` -ge 3 ]; then PYTHON=python fi fi -# Test CommonMark specification compliance -# (using the vanilla specification file): +echo +echo "CommonMark specification:" $PYTHON "$TEST_DIR/spec_tests.py" -s "$TEST_DIR/spec.txt" -p "$PROGRAM" -# More tests for better coverage ten what the spec provides: +echo +echo "Code coverage & regressions:" $PYTHON "$TEST_DIR/spec_tests.py" -s "$TEST_DIR/coverage.txt" -p "$PROGRAM" -# Test various extensions and deviations from the specifications: +echo +echo "Permissive e-mail autolinks extension:" $PYTHON "$TEST_DIR/spec_tests.py" -s "$TEST_DIR/permissive-email-autolinks.txt" -p "$PROGRAM --fpermissive-email-autolinks" + +echo +echo "Permissive URL autolinks extension:" $PYTHON "$TEST_DIR/spec_tests.py" -s "$TEST_DIR/permissive-url-autolinks.txt" -p "$PROGRAM --fpermissive-url-autolinks" + +echo +echo "WWW autolinks extension:" $PYTHON "$TEST_DIR/spec_tests.py" -s "$TEST_DIR/permissive-www-autolinks.txt" -p "$PROGRAM --fpermissive-www-autolinks" + +echo +echo "Tables extension:" $PYTHON "$TEST_DIR/spec_tests.py" -s "$TEST_DIR/tables.txt" -p "$PROGRAM --ftables" + +echo +echo "Strikethrough extension:" $PYTHON "$TEST_DIR/spec_tests.py" -s "$TEST_DIR/strikethrough.txt" -p "$PROGRAM --fstrikethrough" -# Run pathological tests: +echo +echo "Pathological input:" $PYTHON "$TEST_DIR/pathological_tests.py" -p "$PROGRAM" diff --git a/test/pathological_tests.py b/test/pathological_tests.py @@ -72,7 +72,7 @@ passed = 0 errored = 0 failed = 0 -print("Testing pathological cases:") +#print("Testing pathological cases:") for description in pathological: (inp, regex) = pathological[description] [rc, actual, err] = cmark.to_html(inp) @@ -81,7 +81,7 @@ for description in pathological: print(description, '[ERRORED (return code %d)]' %rc) print(err) elif regex.search(actual): - print(description, '[PASSED]') + #print(description, '[PASSED]') passed += 1 else: print(description, '[FAILED]')