Permalink
Please sign in to comment.
Browse files
Initial implementation of 'oilc deps'.
It finds all the commands that a shell script uses, taking into account builtins and functions. (The function logic needs a separate pass.) - Fill out a skeleton for the 'oilc' applet. - Prototype a visitor style which uses ASDL metaprogramming. Unrelated: - Some edits to the quick reference. - enable asdl/arith_parse_test.py
- Loading branch information...
Showing
with
334 additions
and 17 deletions.
- +51 −2 asdl/arith_parse_test.py
- +18 −1 asdl/gen_cpp.py
- +67 −9 bin/oil.py
- +2 −1 doc/osh-quick-ref-toc.txt
- +64 −0 test/oilc.sh
- +0 −4 test/unit.sh
- +132 −0 tools/deps.py
| @@ -0,0 +1,64 @@ | ||
| #!/bin/bash | ||
| # | ||
| # Usage: | ||
| # ./oilc.sh <function name> | ||
| set -o nounset | ||
| set -o pipefail | ||
| set -o errexit | ||
| # TODO: We need a common test framework for command-line syntax of bin/*. The | ||
| # spec tests are doing that now with $SH. | ||
| # osh2oil should be oilc translate. | ||
| fail() { | ||
| echo 'TEST FAILED' | ||
| exit 1 | ||
| } | ||
| usage() { | ||
| set +o errexit | ||
| # missing required subcommand | ||
| bin/oilc | ||
| test $? -eq 2 || fail | ||
| bin/oilc invalid | ||
| test $? -eq 2 || fail | ||
| bin/oilc bin-deps | ||
| test $? -eq 2 || fail | ||
| return | ||
| # Doesn't work yet | ||
| echo -- | ||
| bin/oilc --help | ||
| test $? -eq 0 || fail | ||
| set -o errexit | ||
| } | ||
| deps() { | ||
| bin/oilc deps $0 | ||
| test $? -eq 0 || fail | ||
| } | ||
| readonly -a PASSING=( | ||
| usage | ||
| deps | ||
| ) | ||
| all-passing() { | ||
| for t in "${PASSING[@]}"; do | ||
| # fail calls 'exit 1' | ||
| $t | ||
| echo "OK $t" | ||
| done | ||
| echo | ||
| echo "All osh2oil tests passed." | ||
| } | ||
| "$@" |
Oops, something went wrong.
0 comments on commit
537b49d