toml/test2/run.sh

43 lines
805 B
Bash
Raw Normal View History

2019-10-10 08:11:52 +00:00
if ! (which jq >& /dev/null); then
echo "ERROR: please install the 'jq' utility"
exit 1
fi
2019-10-08 23:58:18 +00:00
#
# POSITIVE tests
#
for i in toml-spec-tests/values/*.toml; do
2019-10-10 11:15:45 +00:00
fname="$i"
ext="${fname##*.}"
fname="${fname%.*}"
echo -n $fname ' '
2019-10-10 08:11:52 +00:00
res='[OK]'
2019-10-10 11:15:45 +00:00
if (../toml_json $fname.toml >& $fname.json.out); then
2019-10-11 00:32:54 +00:00
jq -S . $fname.json.out > t.json
2019-10-10 11:15:45 +00:00
mv t.json $fname.json.out
if [ -f $fname.json ]; then
if ! (diff $fname.json $fname.json.out >& /dev/null); then
res='[FAILED]'
else
rm -f $fname.json.out
fi
else
res='[??]'
2019-10-10 08:11:52 +00:00
fi
2019-10-08 23:58:18 +00:00
fi
2019-10-11 00:34:45 +00:00
echo ... $res
2019-10-08 23:58:18 +00:00
done
#
# NEGATIVE tests
#
for i in toml-spec-tests/errors/*.toml; do
echo -n $i ' '
2019-10-11 00:34:45 +00:00
res='[OK]'
2019-10-10 08:11:52 +00:00
if (../toml_json $i >& $i.json.out); then
2019-10-11 00:34:45 +00:00
res='[FAILED]'
2019-10-08 23:58:18 +00:00
fi
2019-10-11 00:34:45 +00:00
echo ... $res
2019-10-08 23:58:18 +00:00
done