]> diplodocus.org Git - nmh/blob - test/format/test-rightjustify
mhbuildsbr.c: Flip logic, moving goto to then-block; no need for else.
[nmh] / test / format / test-rightjustify
1 #!/bin/sh
2 #
3 # Test that the right justification feature works correctly.
4 #
5
6 if test -z "${MH_OBJ_DIR}"; then
7 srcdir=`dirname "$0"`/../..
8 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
9 fi
10
11 . "$MH_OBJ_DIR/test/common.sh"
12
13 setup_test
14
15 for prefix in '' '>' '2>'; do
16 actual=`run_prog ${MH_LIBEXEC_DIR}/ap -format "$prefix%-20(friendly{text})<<End of test" 'No Such User <nosuch@user.com>'`
17 expected="$prefix No Such User<<End of test"
18 # 1 10 20
19
20 if test x"$actual" != x"$expected"; then
21 echo "$0: right justification test expected:" 1>&2
22 echo " $expected" 1>&2
23 echo "but instead got:" 1>&2
24 echo " $actual" 1>&2
25 failed=`expr ${failed:-0} + 1`
26 fi
27 done
28
29 exit $failed