OILS / doc / error-catalog.sh View on Github | oils.pub

58 lines, 25 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# doc/error-catalog.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10source test/common.sh
11source test/sh-assert.sh # _assert-sh-status
12
13test-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
41soil-run-py() {
42 run-test-funcs
43}
44
45soil-run-cpp() {
46 ninja _bin/cxx-asan/osh
47 OSH=_bin/cxx-asan/osh run-test-funcs
48}
49
50run-for-release() {
51 run-other-suite-for-release error-catalog run-test-funcs
52}
53
54filename=$(basename $0)
55if test $filename = 'error-catalog.sh'; then
56 "$@"
57fi
58