瀏覽代碼

add a little test

main
Jan Lehnardt 3 年之前
父節點
當前提交
1432410974
共有 2 個檔案被更改,包括 37 行新增5 行删除
  1. +5
    -5
      test/test.sh
  2. +32
    -0
      test/test_assert_arg.sh

test.sh → 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"
# . ./wait_for_pid_exit.sh
#
# echo test5
# (wait_for_pid_exit 45591 4 17)
# echo "test5 done"

+ 32
- 0
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

Loading…
取消
儲存