Skip to content

Commit

Permalink
Update tests/README
Browse files Browse the repository at this point in the history
- Use atx headers

- Break on period and comma

- Improve markup of fields
  • Loading branch information
mptre committed Jun 18, 2017
1 parent f37e5e8 commit 9086de2
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
Test suite
==========
# Test suite

The test suite consists of a shell script `pick-test.sh` responsible for running
tests written in the file format described below and `pick-test.c` which will
invoke pick with a pseudo-terminal. This allows sending keyboard input sequences
and reading the output on exit.
invoke pick with a pseudo-terminal.
This allows sending keyboard input sequences and reading the output on exit.

The recommended way to run the test suite is using `make(1)`:

```sh
make check || cat test-suite.log
$ make check || cat test-suite.log
```

Use the `-j` option with a value matching the number of cores on your machine to
speed-up the process:

```sh
make -jN check || cat test-suite.log
$ make -jN check || cat test-suite.log
```

To run one or more specific tests:

```sh
env TESTS=tests/01.t make -e check || cat test-suite.log
$ env TESTS=tests/01.t make -e check || cat test-suite.log
```

Format of test files
--------------------
## Format of test files

A test file consist of fields where field names are terminated with `:` and the
rest of line is recognized as the corresponding field value. Some fields allow
multi-line values. Everything after `#` and up to the next newline is treated as
a comment.
rest of line is recognized as the corresponding field value.
Some fields allow multi-line values.
Everything after `#` and up to the next newline is treated as a comment.

A trivial example:

Expand All @@ -47,30 +45,35 @@ stdout:

The following fields are recognized:

- args
- `args`

Arguments passed to the pick process as is.
Arguments passed to the pick process as is.

- description
- `description`

Purpose of the test.
Purpose of the test.

- exit
- `exit`

Exit code of the pick process, defaults to `0` if omitted.
Exit code of the pick process,
defaults to `0` if omitted.

- keys
- `keys`

Sequence of characters sent as keyboard input to the pick process. The value
will be sent through `printf(1)` prior sending it to the pick process. Spaces
will be stripped, if not escaped. A backslash character is expressed as `\\`,
thus newline equals `\\n` and space `\\ `.
Sequence of characters sent as keyboard input to the pick process.
The value will be sent through `printf(1)` prior sending it to the pick
process.
Spaces will be stripped,
if not escaped.
A backslash character is expressed as `\\`,
thus newline equals `\\n` and space `\\ `.

- stdin
- `stdin`

Multi-line input to the pick process.
Multi-line input to the pick process.

- stdout
- `stdout`

Expected multi-line output from the pick process. If omitted, output assertion
is not performed.
Expected multi-line output from the pick process.
If omitted,
output assertion is not performed.

0 comments on commit 9086de2

Please sign in to comment.