Move 'Test Cases' wiki page from GitHub wiki to website

This commit is contained in:
Thomas Jensen 2015-03-17 13:06:24 +01:00
parent ec820eb842
commit 1140529ba7
5 changed files with 69 additions and 3 deletions

View File

@ -32,7 +32,7 @@ The pull request must meet the criteria mentioned below. If additional changes a
Since *boxes* is not actively being developed anymore, changes to the code base must be "production ready" from the start. The following check list may help:
- The [Travis CI build](https://travis-ci.org/{{ site.github }}) must pass for the pull request. This is indicated by a small green check mark next to your pull request.
- Provide [test cases](https://github.com/{{ site.github }}/wiki/Test-Cases) for any code that you add. This helps make sure that nobody else breaks it later.
- Provide [test cases]({{ site.baseurl}}/testing.html) for any code that you add. This helps make sure that nobody else breaks it later.
- Cross-platform compatibility is very important for *boxes*. Since *boxes* does not (and cannot really) make use of *autoconf*, the C code itself must work on every platform. In other words, you can use only such C commands that are known on every platform. When in doubt, restrict yourself to commands that you already find in the current sources.
These criteria apply only to code changes. (Although other changes should not break the build, either.)

View File

@ -33,7 +33,8 @@
1. Development
a. [Contributing]({{ site.baseurl}}/contributing.html)
b. [List of Contributors]({{ site.baseurl}}/contributing.html#contributors)
c. [Chronological Change Log](https://github.com/{{ site.github }}/commits/master)
c. [Testing]({{ site.baseurl}}/testing.html)
d. [Chronological Change Log](https://github.com/{{ site.github }}/commits/master)
1. [Download]({{ site.baseurl}}/download.html)

View File

@ -0,0 +1,56 @@
# 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.

View File

@ -8,7 +8,7 @@ comments: false
**Version 1.1.2 is out**. Version 1.1.2 is only a maintenance release. There are no new features and no bug fixes, but a few new box designs and several changes to the way that *boxes* is built. So version 1.1.2 should be easier to build on more platforms. <!--break-->
- Several changes to URL references and comments which were prompted by the move to GitHub
- Added low-tech test suite so that we can now write [test cases](https://github.com/{{ site.github }}/wiki/Test-Cases) for *boxes*
- Added low-tech test suite so that we can now write [test cases]({{ site.baseurl}}/testing.html) for *boxes*
- Patch by *Salvatore Bonaccorso* to fix FTBFS on GNU/kFreeBSD and GNU/Hurd
- Patch by *Jakub Hrozek* to eliminate a compilation warning on Fedora
- Patch to make compilation on MacOS easier by *Mike Meyer*

9
testing.html Normal file
View File

@ -0,0 +1,9 @@
---
layout: default
title: Test Cases
---
{% capture includedMarkdown %}{% include boxes/testing.md %}{% endcapture %}
<div class="bxpage well">
{{ includedMarkdown | markdownify }}
</div>