summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/tests/lib/shunit2/shunit2_standalone_test.sh
blob: 2109d8f7f83489663d6cdcabf268efbbc53051c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/sh
# vim:et:ft=sh:sts=2:sw=2
#
# shUnit2 unit test for standalone operation.
#
# 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
#
# 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.
#
### ShellCheck http://www.shellcheck.net/
# $() are not fully portable (POSIX != portable).
#   shellcheck disable=SC2006
# Disable source following.
#   shellcheck disable=SC1090,SC1091

ARGV0="`basename "$0"`"

# Load test helpers.
. ./shunit2_test_helpers

testStandalone() {
  assertTrue "${SHUNIT_TRUE}"
}

main() {
  ${TH_SHUNIT} "${ARGV0}"
}

# Are we running as a standalone?
if [ "${ARGV0}" = 'shunit2_test_standalone.sh' ]; then
  if [ $# -gt 0 ]; then main "$@"; else main; fi
fi