This is a slowly growing collection of hopefully useful and reusable shell functions and patterns. https://code.jan.io/jan/jans_shell_utils
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
517B

  1. #!/bin/sh
  2. # Copyright (c) 2022 Jan Lehnardt <jan@apache.org>, MIT licensed
  3. . ../lib.sh
  4. echo "testing assert_arg"
  5. global_error=0
  6. expect=1
  7. result=`assert_arg`
  8. if [ $? -ne $expect ]; then
  9. echo "assert_arg with no parameter fails"
  10. global_error=1
  11. fi
  12. echo .
  13. expect=0
  14. result=`assert_arg foo`
  15. if [ $? -ne $expect ]; then
  16. echo "assert_arg with parameter does not pass"
  17. global_error=1
  18. echo .
  19. fi
  20. echo .
  21. if [ $global_error -ne 0 ]; then
  22. echo "one or more tests failed"
  23. exit 1
  24. else
  25. echo "all tests pass"
  26. exit 0
  27. fi