| 1 | #!/bin/bash |
| 2 | |
| 3 | set -euo pipefail |
| 4 | |
| 5 | has_clitest() { |
| 6 | command -v clitest > /dev/null |
| 7 | } |
| 8 | |
| 9 | is_python36() { |
| 10 | python --version 2>&1 | grep '^Python 3\.[6-9]' > /dev/null |
| 11 | } |
| 12 | |
| 13 | if is_python36 |
| 14 | then |
| 15 | echo pylint |
| 16 | pylint ./*.py tests/*.py |
| 17 | |
| 18 | echo black |
| 19 | black --check --quiet ./*.py tests/*.py |
| 20 | else |
| 21 | echo pylint - SKIPPED |
| 22 | echo black - SKIPPED |
| 23 | fi |
| 24 | |
| 25 | if has_clitest |
| 26 | then |
| 27 | echo cli tests |
| 28 | clitest --progress none --prefix 4 tests/test_cmdline.md |
| 29 | else |
| 30 | echo cli tests - SKIPPED |
| 31 | fi |
| 32 | |
| 33 | echo doc tests |
| 34 | python -m doctest README.md |
| 35 | |
| 36 | echo unit tests |
| 37 | python -m unittest discover -s tests/ |
| 38 | |
| 39 | echo parse reference file |
| 40 | python sedparse.py -f tests/reference.sed > tests/reference.json |
| 41 | python sedparse.py --verbose --full -f tests/reference.sed > tests/reference.full.json 2> tests/reference.verbose |
| 42 | git diff --exit-code tests/reference.* |