toml/tomlc99/test2/run.sh

45 lines
821 B
Bash
Raw Normal View History

#!/usr/bin/env bash
if ! (which jq >& /dev/null); then
2019-10-10 08:11:52 +00:00
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]'
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
2019-10-10 11:15:45 +00:00
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
2019-10-08 23:58:18 +00:00
echo -n $i ' '
2019-10-11 00:34:45 +00:00
res='[OK]'
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