Commit 78bdaa74 authored by Mathieu Giraud's avatar Mathieu Giraud

should, demo/*.should, src/should.py, README.md: brand the program as `should`

parent 4f016af4
[![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)
### `should.py` -- Test command-line applications through `.should` files
### `should` -- Test command-line applications through `.should` files
`should.py` is a single-file program to test command-line applications.
`should` is a single-file program to test command-line applications.
It checks the standard output, or possibly another file, and parses for exact or regular expressions,
possibly while counting them and checking their number of occurrences.
It outputs reports in [`.tap` format](https://testanything.org/tap-specification.html)
and (soon, #1) in JUnit XML.
`should.py` is written in Python 3 with no external dependencies and is intended to work on any command-line application
`should` is written in Python 3 with no external dependencies and is intended to work on any command-line application
-- should your application outputs something, you can test it!
......@@ -61,10 +61,10 @@ r: [Hh]ello,\s+world
```
The test is then run by calling `should.py` on the `.should` file:
The test is then run by calling `should` on the `.should` file:
```shell
> python3 src/should.py demo/hello.should
> ./should demo/hello.should
$LAUNCHER=
demo/hello.should
......@@ -89,11 +89,11 @@ demo/hello.should
```
`should.py` can be run on several `.should` files at once. In this case, it furthers show statistics
`should` can be run on several `.should` files at once. In this case, it furthers show statistics
on all tests. Here 39 out of 40 tests passed from 8 `.should` files.
```shell
> python3 src/should.py demo/*.should
> ./should demo/*.should
(...)
Summary ==> ok - ok:8 total:8 files
......@@ -117,9 +117,9 @@ for example to launch tools like `valgrind` on a test set.
**Options and modifiers**
```shell
python3 should.py -h
./should -h
usage: should.py [-h] [--cd PATH] [--cd-same] [--launcher CMD]
usage: should [-h] [--cd PATH] [--cd-same] [--launcher CMD]
[--mod MODIFIERS] [--var NAME=value] [--log] [--tap] [-v]
[-q]
should-file [should-file ...]
......@@ -152,7 +152,7 @@ output options:
**Output.**
By default, `should.py` only writes to the standard output.
By default, `should` only writes to the standard output.
The `--log` and the `--tap` options enable to store the actual output of the tested commands
as well as [`.tap` files](https://testanything.org/tap-specification.html).
......
# The --launcher option allows to prepend something to every command.
# It could be used with valgrind or other tools.
python3 src/should.py --launcher echo demo/cal.should ; true
./should --launcher echo demo/cal.should ; true
$ The command is launched with 'echo'
: LANG=C cal 2001
......
# should.py --retry relaunches the previous failed or warned tests,
# with the same options that at the first call.
python3 src/should.py -v demo/hello.should demo/cal.should
python3 src/should.py --retry
./should -v demo/hello.should demo/cal.should
./should --retry
$ 'cal.should' was labeled as 'TODO-but-ok' at both calls
rl: files with.*TODO-but-ok.*demo/cal.should.*Retrying
......
#!/usr/bin/env python3
# should.py -- Test command-line applications through .should files
# should -- Test command-line applications through .should files
#
# Copyright (C) 2018 by CRIStAL (UMR CNRS 9189, Université Lille) and Inria Lille
# Contributors:
......@@ -12,13 +12,13 @@
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# "should.py" is distributed in the hope that it will be useful,
# "should" is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with "should.py". If not, see <http://www.gnu.org/licenses/>
# along with "should". If not, see <http://www.gnu.org/licenses/>
import sys
......@@ -178,7 +178,7 @@ for (mod_char, mod_long, mod_help) in MODIFIERS:
parser = ArgParser(description='Test command-line applications through .should files',
fromfile_prefix_chars='@',
epilog='''Example:
python3 %(prog)s demo/hello.should''',
%(prog)s demo/hello.should''',
formatter_class=argparse.RawTextHelpFormatter)
options = ArgParser(fromfile_prefix_chars='@') # Can be used in !OPTIONS: directive
......
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