1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#!/bin/sh
# Tests for ap(8)'s coverage.
if test -z "${MH_OBJ_DIR}"; then
srcdir=`dirname "$0"`/../..
MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
fi
. "$MH_OBJ_DIR/test/common.sh"
setup_test
# Use proper program, likely not the first one on PATH.
ap="${MH_LIBEXEC_DIR}/ap"
start_test 'ambiguous switch'
check_exit '-eq 1' $ap -
start_test 'invalid switch'
check_exit '-eq 1' $ap -xyzzy
start_test 'help'
check_exit '-eq 0' $ap -help
start_test 'version'
check_exit '-eq 0' $ap -version
start_test 'missing -form argument'
check_exit '-eq 1' $ap -format foo -form
start_test 'missing -format argument'
check_exit '-eq 1' $ap -form foo -format
start_test 'missing -width argument'
check_exit '-eq 1' $ap -width
x=tendixzehn
l=$x$x$x$x$x
c=$l$l
start_test 'more than 100 addresses'
check_exit '-eq 1' $ap `echo $c | sed 's/./ &/g'` 101
start_test 'no addresses'
check_exit '-eq 1' $ap
start_test 'success, though alias not found'
COLUMNS=1 check_exit '-eq 0' $ap foo
#### Make sure that 8-bit character is properly interpreted.
require_locale $en_locales
start_test 'address with 8-bit character'
check_exit '-eq 1' $ap -width 0 `printf 'f\357o'`
finish_test
|