]> diplodocus.org Git - nmh/commitdiff
Add test/format/test-ap to get 100% uip/ap.c coverage.
authorRalph Corderoy <ralph@inputplus.co.uk>
Tue, 8 Nov 2016 23:32:23 +0000 (23:32 +0000)
committerRalph Corderoy <ralph@inputplus.co.uk>
Tue, 8 Nov 2016 23:32:23 +0000 (23:32 +0000)
Makefile.am
test/format/test-ap [new file with mode: 0755]

index 3f00dc16490f30b0e26c3c2fd39708e4d70ce6a6..ad03cc58ac74c634c6c4ad03e7d4a11a3c601477 100644 (file)
@@ -59,6 +59,7 @@ TESTS = test/ali/test-ali test/anno/test-anno \
        test/folder/test-create test/folder/test-nocreate \
        test/folder/test-packf test/folder/test-recurse \
        test/folder/test-sortm test/folder/test-total \
        test/folder/test-create test/folder/test-nocreate \
        test/folder/test-packf test/folder/test-recurse \
        test/folder/test-sortm test/folder/test-total \
+       test/format/test-ap \
        test/format/test-curses test/format/test-dp \
        test/format/test-fmtdump test/format/test-functions \
        test/format/test-localmbox test/format/test-myname \
        test/format/test-curses test/format/test-dp \
        test/format/test-fmtdump test/format/test-functions \
        test/format/test-localmbox test/format/test-myname \
diff --git a/test/format/test-ap b/test/format/test-ap
new file mode 100755 (executable)
index 0000000..517ba40
--- /dev/null
@@ -0,0 +1,32 @@
+#!/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"
+
+check_exit '-eq 1' $ap -
+check_exit '-eq 1' $ap -xyzzy
+check_exit '-eq 0' $ap -help
+check_exit '-eq 0' $ap -version
+check_exit '-eq 1' $ap -format foo -form
+check_exit '-eq 1' $ap -form foo -format
+check_exit '-eq 1' $ap -width
+x=tendixzehn
+l=$x$x$x$x$x
+c=$l$l
+check_exit '-eq 1' $ap `echo $c | sed 's/./ &/g'` 101
+check_exit '-eq 1' $ap
+COLUMNS=1 check_exit '-eq 0' $ap foo
+check_exit '-eq 1' $ap -width 0 `printf 'f\357o'`
+
+finish_test