implement game configuration file
this integrates https://github.com/cktan/tomlc99 into the repo as a dependency
This commit is contained in:
1
third-party/tomlc99/test2/.gitignore
vendored
Normal file
1
third-party/tomlc99/test2/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/toml-spec-tests
|
6
third-party/tomlc99/test2/Note.txt
vendored
Normal file
6
third-party/tomlc99/test2/Note.txt
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
Note that we utilize the 'jq' command to normalize json files for comparison. Depending the
|
||||
verson of jq on your system, some tests may generate error that looks like this:
|
||||
|
||||
parse error: Exceeds depth limit for parsing at line 1
|
||||
|
||||
This is an error in 'jq', and it does not indicate that the tests themselves fail.
|
7
third-party/tomlc99/test2/build.sh
vendored
Normal file
7
third-party/tomlc99/test2/build.sh
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
[ -d toml-spec-tests ] || git clone https://github.com/cktan/toml-spec-tests.git
|
44
third-party/tomlc99/test2/run.sh
vendored
Normal file
44
third-party/tomlc99/test2/run.sh
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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
|
||||
fname="$i"
|
||||
ext="${fname##*.}"
|
||||
fname="${fname%.*}"
|
||||
echo -n $fname ' '
|
||||
res='[OK]'
|
||||
if (../toml_json $fname.toml >& $fname.json.out); then
|
||||
jq -S . $fname.json.out > t.json
|
||||
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='[??]'
|
||||
fi
|
||||
fi
|
||||
echo ... $res
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# NEGATIVE tests
|
||||
#
|
||||
for i in toml-spec-tests/errors/*.toml; do
|
||||
echo -n $i ' '
|
||||
res='[OK]'
|
||||
if (../toml_json $i >& $i.json.out); then
|
||||
res='[FAILED]'
|
||||
fi
|
||||
echo ... $res
|
||||
done
|
Reference in New Issue
Block a user