hoedown/hoedown — pull request #122 by uranusjr (2014-09-09 08:45:30+00:00)
Title: New test framework based on Python’s unittest module

A new, generic test runner made with Python that is capable of testing extensions.

Tests are loaded from `config.json` on runtime and injected into the test class. The tests are then ran by Python’s built-in `unittest` framework. `make test` is updated to use the new test script.

Each test case in `config.json` must contain two attributes: `input` and `output`, specifying paths of file to feed into Hoedown, and file containing expected output. The paths are relative to `/test`. Two optional parameters are also supported:

* `skip`: A boolean indicating whether a given test should be skipped.
* `flags`: A list containing extra arguments to be passed into the Hoedown executable. Can be used to enable extensions.

Currently the script expects the well-formed configs, and not much error-handling is implemented. If tailed tests occur, the script will spit the content of related documents as-is. I plan to add auto diff-ing with Python’s `difflib`.

I added all standard tests along with `Escape character` which I made when fixing #89. But it’s currently marked as skipped because for some reason **the image escaping part doesn’t pass**. (Will need to fix that.) The test used when implementing math syntax is also added (with modification since the implementation changed a bit).

The script is now Python 2-only (2.6+ I think; not tested) because the metaclass syntax in Python 3 is not compatible with Python 2. I can make a compatibility layer to make it run on both versions if you think it’s appropriate.