2
0
mirror of https://github.com/deajan/osync synced 2024-11-17 09:25:42 +00:00
osync/dev/tests/shunit2/shunit2_standalone_test.sh

39 lines
985 B
Bash
Raw Normal View History

2016-08-22 08:26:38 +00:00
#! /bin/sh
# vim:et:ft=sh:sts=2:sw=2
#
# shUnit2 unit test for standalone operation.
#
2018-07-02 21:25:49 +00:00
# Copyright 2010-2017 Kate Ward. All Rights Reserved.
# Released under the Apache 2.0 license.
#
# Author: kate.ward@forestent.com (Kate Ward)
# https://github.com/kward/shunit2
#
2016-08-22 08:26:38 +00:00
# This unit test is purely to test that calling shunit2 directly, while passing
# the name of a unit test script, works. When run, this script determines if it
# is running as a standalone program, and calls main() if it is.
2018-07-02 21:25:49 +00:00
#
### ShellCheck http://www.shellcheck.net/
# $() are not fully portable (POSIX != portable).
# shellcheck disable=SC2006
# Disable source following.
# shellcheck disable=SC1090,SC1091
2016-08-22 08:26:38 +00:00
2018-07-02 21:25:49 +00:00
ARGV0="`basename "$0"`"
2016-08-22 08:26:38 +00:00
2018-07-02 21:25:49 +00:00
# Load test helpers.
2016-08-22 08:26:38 +00:00
. ./shunit2_test_helpers
2018-07-02 21:25:49 +00:00
testStandalone() {
assertTrue "${SHUNIT_TRUE}"
2016-08-22 08:26:38 +00:00
}
2018-07-02 21:25:49 +00:00
main() {
2016-08-22 08:26:38 +00:00
${TH_SHUNIT} "${ARGV0}"
}
2018-07-02 21:25:49 +00:00
# Are we running as a standalone?
2016-08-22 08:26:38 +00:00
if [ "${ARGV0}" = 'shunit2_test_standalone.sh' ]; then
if [ $# -gt 0 ]; then main "$@"; else main; fi
fi