| 1 | #!/usr/bin/env bash
|
| 2 | #
|
| 3 | # Usage:
|
| 4 | # doc/error-catalog.sh <function name>
|
| 5 |
|
| 6 | set -o nounset
|
| 7 | set -o pipefail
|
| 8 | set -o errexit
|
| 9 |
|
| 10 | source test/common.sh
|
| 11 | source test/sh-assert.sh # _assert-sh-status
|
| 12 |
|
| 13 | test-bool-operator() {
|
| 14 | if false; then
|
| 15 | # Doesn't give an error, because ! is used in Eggex
|
| 16 | _ysh-error-X 2 '
|
| 17 | if (!a || b && c) {
|
| 18 | echo no
|
| 19 | }
|
| 20 | '
|
| 21 | fi
|
| 22 |
|
| 23 | _ysh-error-X 2 '
|
| 24 | if (a || b && c) {
|
| 25 | echo no
|
| 26 | }
|
| 27 | '
|
| 28 |
|
| 29 | # Hm 'not' is a not a command - this is the 'boolstatus' problem
|
| 30 | _ysh-error-X 0 '
|
| 31 | if not test --dir a or test --dir b and test --dir c {
|
| 32 | echo no
|
| 33 | }
|
| 34 | '
|
| 35 | }
|
| 36 |
|
| 37 | #
|
| 38 | # Entry Points (copied from test/ysh-parse-errors.sh)
|
| 39 | #
|
| 40 |
|
| 41 | soil-run-py() {
|
| 42 | run-test-funcs
|
| 43 | }
|
| 44 |
|
| 45 | soil-run-cpp() {
|
| 46 | ninja _bin/cxx-asan/osh
|
| 47 | OSH=_bin/cxx-asan/osh run-test-funcs
|
| 48 | }
|
| 49 |
|
| 50 | run-for-release() {
|
| 51 | run-other-suite-for-release error-catalog run-test-funcs
|
| 52 | }
|
| 53 |
|
| 54 | filename=$(basename $0)
|
| 55 | if test $filename = 'error-catalog.sh'; then
|
| 56 | "$@"
|
| 57 | fi
|
| 58 |
|