Skip to content

Commit c44fb8b

Browse files
committed
Add information about writing tests
1 parent 2ebe44f commit c44fb8b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/contrib.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,23 @@ Template for the pages (the one which creates small violet header and footer, de
7979
`<!--?template myfunnytemplate-->`
8080

8181
The templates are cached for about 3600 seconds, rather than 300 seconds for ordinary pages, so be patient :)
82+
83+
## Tests
84+
85+
If your article involves code snippets, then it would be great you also contribute tests for them.
86+
This way we can make sure that the snippets actually work, and don't contain any bugs.
87+
88+
Creating tests works like this:
89+
You have to name each snippet that you want to test in the markdown article:
90+
91+
```cpp snippet-name
92+
// some code
93+
```
94+
95+
In the directory `test` you find a script `extract_snippets.py` that you can run.
96+
This script extracts from every article all named snippets, and puts them in C++ header files: `snippet-name.h`
97+
In the folder you can create a cpp file, that includes these snippets headers, and tests their behaviour.
98+
If the snippets don't work, the test program should return 1 instead of 0.
99+
100+
You can run all tests with the script `test.sh`.
101+
Also, every pull-request will automatically tested via [Travis CI](https://travis-ci.org/e-maxx-eng/e-maxx-eng/), and the result of the tests will be shown.

0 commit comments

Comments
 (0)