2019-04-22 18:34:43 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-01-17 08:57:08 +00:00
|
|
|
#### $$VERSION$$ v1.30-0-g3266427
|
2019-04-22 18:34:43 +00:00
|
|
|
|
|
|
|
# include common functions and definitions
|
|
|
|
# shellcheck source=test/ALL-tests.inc.sh
|
|
|
|
source "./ALL-tests.inc.sh"
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# source bashbot.sh functionw
|
|
|
|
cd "${TESTDIR}" || exit 1
|
|
|
|
|
|
|
|
# run JSON.sh with and without options
|
|
|
|
cd "test" || exit 1
|
2021-01-02 22:17:14 +00:00
|
|
|
printf "Check JSON.sh ...\n"
|
2019-04-22 18:34:43 +00:00
|
|
|
JSON="../JSON.sh/JSON.sh"
|
|
|
|
|
|
|
|
for i in 1 2
|
|
|
|
do
|
2021-01-02 22:17:14 +00:00
|
|
|
[ "${i}" = "1" ] && printf " ... JSON.sh -b -n\n"
|
|
|
|
[ "${i}" = "2" ] && printf " ... JSON.sh\n"
|
2019-04-22 18:34:43 +00:00
|
|
|
set +f
|
2019-12-07 12:25:50 +00:00
|
|
|
for jsonfile in "${REFDIR}"/*.in
|
2019-04-22 18:34:43 +00:00
|
|
|
do
|
|
|
|
set -f
|
2020-10-06 12:07:30 +00:00
|
|
|
[ "${i}" = "1" ] && "${JSON}" -b -n <"${jsonfile}" >"${jsonfile}.out-${i}"
|
2019-04-22 18:34:43 +00:00
|
|
|
[ "${i}" = "2" ] && "${JSON}" <"${jsonfile}" >"${jsonfile}.out-${i}"
|
|
|
|
|
|
|
|
# output processed input
|
2019-05-01 09:46:57 +00:00
|
|
|
diff -c "${jsonfile%.in}.result-${i}" "${jsonfile}.out-${i}" || exit 1
|
2019-04-22 18:34:43 +00:00
|
|
|
done
|
2021-01-02 22:17:14 +00:00
|
|
|
printf "%s\n" "${SUCCESS}"
|
2019-04-22 18:34:43 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
cd "${DIRME}" || exit 1
|