1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-15 04:03:41 +01:00
obackup/dev/tests/shunit2/shunit2_standalone_test.sh

39 lines
985 B
Bash
Raw Permalink Normal View History

2016-08-18 14:19:52 +02:00
#! /bin/sh
# vim:et:ft=sh:sts=2:sw=2
#
# shUnit2 unit test for standalone operation.
#
2018-09-30 16:31:34 +02: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-18 14:19:52 +02: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-09-30 16:31:34 +02:00
#
### ShellCheck http://www.shellcheck.net/
# $() are not fully portable (POSIX != portable).
# shellcheck disable=SC2006
# Disable source following.
# shellcheck disable=SC1090,SC1091
2016-08-18 14:19:52 +02:00
2018-09-30 16:31:34 +02:00
ARGV0="`basename "$0"`"
2016-08-18 14:19:52 +02:00
2018-09-30 16:31:34 +02:00
# Load test helpers.
2016-08-18 14:19:52 +02:00
. ./shunit2_test_helpers
2018-09-30 16:31:34 +02:00
testStandalone() {
assertTrue "${SHUNIT_TRUE}"
2016-08-18 14:19:52 +02:00
}
2018-09-30 16:31:34 +02:00
main() {
2016-08-18 14:19:52 +02:00
${TH_SHUNIT} "${ARGV0}"
}
2018-09-30 16:31:34 +02:00
# Are we running as a standalone?
2016-08-18 14:19:52 +02:00
if [ "${ARGV0}" = 'shunit2_test_standalone.sh' ]; then
if [ $# -gt 0 ]; then main "$@"; else main; fi
fi