diff --git a/test2/build.sh b/test2/build.sh index 81af053..74da4d0 100644 --- a/test2/build.sh +++ b/test2/build.sh @@ -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 diff --git a/test2/run.sh b/test2/run.sh index e18f306..95504f8 100644 --- a/test2/run.sh +++ b/test2/run.sh @@ -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