File tree 2 files changed +48
-0
lines changed
2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ # this java property file contains the testdata
2
+ # above, below and this line are comments
3
+ # following lines contain testdata
4
+ td_key_empty =
5
+ td_key_value =td_value_string
6
+
7
+ # following property tuples(key/value pairs) are critical cases
8
+ td_bash_special_backtick =`
9
+ td_bash_specical =~$&*()\|[]{};'"<>/?!#
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ #
4
+ script_dir=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]:- .} " ) " & > /dev/null && pwd )
5
+
6
+ # test for variable existence and output value if found
7
+ test_env_var_existence () {
8
+ declare envvar_name=$1
9
+ if [[ ! -v ${envvar_name} ]]; then
10
+ echo " env var is not set"
11
+ elif [[ -z " ${envvar_name} " ]]; then
12
+ echo " env var is set to the empty string"
13
+ else
14
+ echo " env var ${envvar_name} =${! envvar_name} "
15
+ fi
16
+
17
+ # echo -ne "checking env variable for $envvar_name ... "
18
+ # if [ -n "${!envvar_name}" ]; then
19
+ # echo "found env var $envvar_name=${!envvar_name}"
20
+ # else
21
+ # echo "missing prop $envvar_name" && exit 1
22
+ # fi
23
+ }
24
+
25
+ test_env_var () {
26
+ declare envvar_name=" $1 "
27
+ declare value=" $2 "
28
+ test_env_var_existence " ${envvar_name} "
29
+ if [[ ${value} == ${! envvar_name} ]]; then
30
+ echo " found env var ${envvar_name} =${! envvar_name} "
31
+ else
32
+ echo " env <${envvar_name} >=<${! value} > is not expected value <$value >" && exit 1
33
+ fi
34
+ }
35
+
36
+ . ${script_dir} /../.klibio/prop2env.sh ${script_dir} /testdata/java_env.properties
37
+
38
+ test_env_var_existence td_key_empty
39
+ test_env_var td_key_value td_value_string
You can’t perform that action at this time.
0 commit comments