update test2

This commit is contained in:
CK Tan 2019-10-10 01:11:52 -07:00
parent 9ed009b950
commit 896561d5b7
2 changed files with 17 additions and 14 deletions

View File

@ -2,5 +2,5 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
[ -d toml-spec-tests ] || git clone https://github.com/iarna/toml-spec-tests.git
[ -d toml-spec-tests ] || git clone https://github.com/cktan/toml-spec-tests.git

View File

@ -1,16 +1,22 @@
if ! (which jq >& /dev/null); then
echo "ERROR: please install the 'jq' utility"
exit 1
fi
#
# POSITIVE tests
#
for i in toml-spec-tests/values/*.toml; do
echo -n $i ' '
../toml_json $i >& $i.json.out
rc=$?
[ -f $i.json ] && diff=$(diff $i.json $i.json.out) || diff=''
if [ "$rc" != "0" ] || [ "$diff" != "" ]; then
echo '[FAILED]'
else
echo '[OK]'
res='[OK]'
if (../toml_json $i >& $i.json.out); then
jq . $i.json.out > t.json
mv t.json $i.json.out
if (diff $i.json $i.json.out >& /dev/null); then
res='[FAILED]'
fi
fi
echo $res
done
@ -19,13 +25,10 @@ done
#
for i in toml-spec-tests/errors/*.toml; do
echo -n $i ' '
../toml_json $i >& $i.json.out
rc=$?
if [ "$rc" != "0" ]; then
echo '[OK]'
else
if (../toml_json $i >& $i.json.out); then
echo '[FAILED]'
else
echo '[OK]'
fi
done