Commit 6f54122b authored by Tilman Kranz's avatar Tilman Kranz

add documentation of test procedures

parent ed903677
# Testing
## Running all Tests
```shell
./utils/test.sh
```
## Running noninteractive Tests only
```shell
./utils/test.sh --noninteractive
```
## Running Test of an individual Script
```shell
./utils/test.sh 01-basics/1-indentation.sh
```
## Internals
By default, every executable in a numbered subdirectory that has a name
ending with `.sh` or `.bash` is tested.
Testing an executable means
1. Running it through [Shellcheck.md](Shellcheck), and then
2. executing it.
Before executing the script, the [utils/test.sh](Test Utility) scans the
file for special comments containing `@Test [ARGUMENT ...]`, `@TestRv INT`
and `@TestInteractive true|false`, that, if present, indicate if and how the
test should be run.
Arguments for the test execution can be provided by including a line as
follows somewhere in the script:
```shell
# @Test --foo --bar
```
Testing is marked as "interactive", meaning, it requires user interaction,
if the script contains the following line:
```shell
# @TestInteractive true
```
Running the script should return exit code 0 by default for the test to
succeed. If a different value is expected, it can be provided using the
`@TestRv` comment. For example, to indicate that a script, when tested,
should return an exit code 1:
```shell
# @TestRv 1
```
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment