From 1432410974b9e4e3b61d224b650546f5e9988885 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sun, 18 Dec 2022 12:41:04 +0100 Subject: [PATCH] add a little test --- test.sh => test/test.sh | 10 +++++----- test/test_assert_arg.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) rename test.sh => test/test.sh (76%) create mode 100755 test/test_assert_arg.sh diff --git a/test.sh b/test/test.sh similarity index 76% rename from test.sh rename to test/test.sh index e4d6734..d501336 100755 --- a/test.sh +++ b/test/test.sh @@ -19,8 +19,8 @@ # echo -. ./wait_for_pid_exit.sh - -echo test5 -(wait_for_pid_exit 45591 4 17) -echo "test5 done" \ No newline at end of file +# . ./wait_for_pid_exit.sh +# +# echo test5 +# (wait_for_pid_exit 45591 4 17) +# echo "test5 done" \ No newline at end of file diff --git a/test/test_assert_arg.sh b/test/test_assert_arg.sh new file mode 100755 index 0000000..91b6683 --- /dev/null +++ b/test/test_assert_arg.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +. ../lib.sh + +echo "testing assert_arg" + +global_error=0 + +expect=1 +result=`assert_arg` +if [ $? -ne $expect ]; then + echo "assert_arg with no parameter fails" + global_error=1 +fi +echo . + +expect=0 +result=`assert_arg foo` +if [ $? -ne $expect ]; then + echo "assert_arg with parameter does not pass" + global_error=1 + echo . +fi +echo . + +if [ $global_error -ne 0 ]; then + echo "one or more tests failed" + exit 1 +else + echo "all tests pass" + exit 0 +fi \ No newline at end of file