From 49b0eb1a2a99dc82b81a9355bb7851db6423486a Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 14 Jan 2024 19:05:28 +0000 Subject: Factor out 'test invalid' checks git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4837 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- test/test-invalid.inc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/test-invalid.inc (limited to 'test/test-invalid.inc') diff --git a/test/test-invalid.inc b/test/test-invalid.inc new file mode 100644 index 00000000..e24cfd3f --- /dev/null +++ b/test/test-invalid.inc @@ -0,0 +1,16 @@ +echo 1>&2 +echo "Invalid command-line argument combination(s)." 1>&2 +echo "Error message(s) should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +# define function +invCmd () { $1 > ${test_out} && \ + printf "Unexpected success ${testcnt} " || printf "Expected failure ${testcnt} " + test -s ${test_out} && echo "unexpected output" || echo "(no output)" + rm -f ${test_out} + testcnt=$(($testcnt +1)); } + +testcnt=1 -- cgit 1.4.1