New layout 'markdown', apply to testing.html as guinea pig

This commit is contained in:
Thomas Jensen 2015-05-12 21:42:57 +02:00
parent 39cbe45826
commit 9968e3732d
3 changed files with 74 additions and 61 deletions

View File

@ -1,56 +0,0 @@
# Test Cases
The boxes sources have a low-tech test suite in the [test](https://github.com/{{ site.github }}/tree/master/test) subdirectory.
Travis CI will execute it in order to make sure that a change did not break the program.
Currently, the test suite could use more test cases, so any help with growing the number of tests is highly appreciated.
<a class="bxOffsetAnchor" name="invocation"></a>
## Invocation&nbsp;
Start the entire suite by running `make && make test` from the top level directory.
Run an individual test by calling `./testrunner.sh testcase.txt` from the *test* directory.
<a class="bxOffsetAnchor" name="test-case-format"></a>
## Test&nbsp;Case Format
Each test case is a single file within the *test* subdirectory. It must follow this naming convention:
nnn_description.txt
where `nnn` is a three-digit number which uniquely identifies the test case. `description` is any short text that describes what the test case does. It must not contain spaces; use underscores instead. The file extension is always `.txt`.
A test case that tests a **successful** invocation of boxes looks like this:
:ARGS
-s 10x4
:INPUT
foo
:OUTPUT-FILTER
:EXPECTED
/********/
/* foo */
/* */
/********/
:EOF
Sections may be empty, e.g. if there are no arguments or there is no input.
A test case that makes sure boxes **fails** under certain conditions looks like this:
:ARGS
-f nonexistent
:INPUT
:OUTPUT-FILTER
:EXPECTED-ERROR 1
boxes: Couldn't open config file 'nonexistent' for input.
:EOF
Note that you write `:EXPECTED-ERROR` instead of just `:EXPECTED`, and the expected return code is given after a space (in this example, it is `1`).
The `:OUTPUT-FILTER` section can be used to give a *sed* script which is run on the actual output before comparing it to the expected output ([example](https://github.com/{{ site.github }}/blob/master/test/065_size_missing_argument.txt)). This way, differences in output that occur because of platform differences can be filtered out. The general advice is to leave this section empty unless you are facing a situation where there is no other solution.

17
_layouts/markdown.html Normal file
View File

@ -0,0 +1,17 @@
{% include header.html %}
<div class="container container-left">
<div class="row">
<div class="col-md-3 hidden-xs">
{% include sidebar.html %}
</div>
<div class="col-md-9">
<div class="bxpage well">
{% capture includedMarkdown %}{{ content }}{% endcapture %}{{ includedMarkdown | markdownify }}
</div>
</div>
</div>
</div>
{% include footer.html %}

View File

@ -1,9 +1,61 @@
---
layout: default
layout: markdown
title: Test Cases
---
{% capture includedMarkdown %}{% include boxes/testing.md %}{% endcapture %}
<div class="bxpage well">
{{ includedMarkdown | markdownify }}
</div>
# Test Cases
The boxes sources have a low-tech test suite in the [test](https://github.com/{{ site.github }}/tree/master/test) subdirectory.
Travis CI will execute it in order to make sure that a change did not break the program.
Currently, the test suite could use more test cases, so any help with growing the number of tests is highly appreciated.
<a class="bxOffsetAnchor" name="invocation"></a>
## Invocation&nbsp;
Start the entire suite by running `make && make test` from the top level directory.
Run an individual test by calling `./testrunner.sh testcase.txt` from the *test* directory.
<a class="bxOffsetAnchor" name="test-case-format"></a>
## Test&nbsp;Case Format
Each test case is a single file within the *test* subdirectory. It must follow this naming convention:
nnn_description.txt
where `nnn` is a three-digit number which uniquely identifies the test case. `description` is any short text that describes what the test case does. It must not contain spaces; use underscores instead. The file extension is always `.txt`.
A test case that tests a **successful** invocation of boxes looks like this:
:ARGS
-s 10x4
:INPUT
foo
:OUTPUT-FILTER
:EXPECTED
/********/
/* foo */
/* */
/********/
:EOF
Sections may be empty, e.g. if there are no arguments or there is no input.
A test case that makes sure boxes **fails** under certain conditions looks like this:
:ARGS
-f nonexistent
:INPUT
:OUTPUT-FILTER
:EXPECTED-ERROR 1
boxes: Couldn't open config file 'nonexistent' for input.
:EOF
Note that you write `:EXPECTED-ERROR` instead of just `:EXPECTED`, and the expected return code is given after a space (in this example, it is `1`).
The `:OUTPUT-FILTER` section can be used to give a *sed* script which is run on the actual output before comparing it to the expected output ([example](https://github.com/{{ site.github }}/blob/master/test/065_size_missing_argument.txt)). This way, differences in output that occur because of platform differences can be filtered out. The general advice is to leave this section empty unless you are facing a situation where there is no other solution.