mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-01-22 13:48:36 +01:00
Add :DESC section to test case description
This commit is contained in:
parent
968e65a028
commit
60e09a0cc1
25
testing.html
25
testing.html
@ -8,8 +8,6 @@ title: Test Cases
|
||||
The boxes sources have a low-tech test suite in the [test](https://github.com/{{ site.github }}/tree/master/test){:target="_blank"} 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>
|
||||
|
||||
@ -28,10 +26,15 @@ Each test case is a single file within the *test* subdirectory. It must follow t
|
||||
|
||||
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`.
|
||||
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:
|
||||
|
||||
:DESC
|
||||
Tests invoking boxes with a fixed result box size.
|
||||
|
||||
:ARGS
|
||||
-s 10x4
|
||||
:INPUT
|
||||
@ -44,10 +47,15 @@ A test case that tests a **successful** invocation of boxes looks like this:
|
||||
/********/
|
||||
:EOF
|
||||
|
||||
Sections may be empty, e.g. if there are no arguments or there is no input.
|
||||
Sections may be empty, e.g. if there are no arguments or there is no input. The `:DESC` section is optional, so it is
|
||||
valid if the test case starts with an `:ARGS` section. The order of sections is fixed.
|
||||
|
||||
A test case that makes sure boxes **fails** under certain conditions looks like this:
|
||||
|
||||
:DESC
|
||||
Tests that the right error message is shown when the boxes
|
||||
config file cannot be found.
|
||||
|
||||
:ARGS
|
||||
-f nonexistent
|
||||
:INPUT
|
||||
@ -56,6 +64,11 @@ A test case that makes sure boxes **fails** under certain conditions looks like
|
||||
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`).
|
||||
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){:target="_blank"}). 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.
|
||||
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){:target="_blank"}).
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user