#!/bin/bash # # Usage: # ./oshc-deps.sh set -o nounset set -o pipefail set -o errexit source test/common.sh # 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 oshc translate. # Compare osh code on stdin (fd 0) and expected oil code on fd 3. proc assert-deps { bin/oshc deps | diff -u /dev/fd/3 - || fail } proc usage { set +o errexit # missing required subcommand bin/oshc test $Status -eq 2 || fail bin/oshc invalid test $Status -eq 2 || fail # Syntax error echo '<' | bin/oshc deps test $Status -eq 2 || fail # File not found bin/oshc deps nonexistent.txt test $Status -eq 2 || fail return # Doesn't work yet echo -- bin/oshc --help test $Status -eq 0 || fail set -o errexit } proc deps { bin/oshc deps $0 test $Status -eq 0 || fail # Have to go inside a condition assert-deps << """ 3<