Extending cmark-gfm pt.3

Bugs, et al.

We’ve written up our code. It works and life is good. Or is it? Are modifications we’ve made going to break the code we already have. Life is good…?

To answer this and be confident that nothing breaks, when we inevitably modify our code later, we are going to add on to the test cases that are run automatically at build time via make test.

Test cases are found under the tests directory. The existing test samples have the following format, and are easy enough to follow along

An example test case would be

title: Reddit extensions test
author: George Philip Malayil
version: 0.1
date: '2022-06-25'
license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)'

## Spoiler

```````````````````````````````` example
Let's have some >!long spoiler!< text.
<p>Let's have some <span class="spoiler">long spoiler</span> text.</p>

The test script uses the cmark parser built at src/main.c. We need to ensure the reddit extension we’ve written is registered by the parser at initialization. Add the following line to src/main.c: int main()


Finally, edit test/CMakeLists.txt to add to the test cases that are run when we build and test our code.

      "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/reddit_extensions.txt"
      "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark-gfm"
      "--extensions" "reddit_spoiler"

Run make && make test, and we should see that our test cases are executed (and, fingers crossed, pass) every time we build our code. Life is good!