v0.5 compliant

This commit is contained in:
CK Tan 2019-10-08 16:58:18 -07:00
parent 63793f92ef
commit c32a6e92f1
13 changed files with 1592 additions and 1444 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
*~
# Object files # Object files
*.o *.o
*.ko *.ko

View file

@ -92,10 +92,18 @@ A normal *make* suffices. Alternately, you can also simply include the
To test against the standard test set provided by BurntSushi/toml-test: To test against the standard test set provided by BurntSushi/toml-test:
``` ```
% make % make
% cd test % cd test1
% bash build.sh # do this once % bash build.sh # do this once
% bash run.sh # this will run the test suite % bash run.sh # this will run the test suite
``` ```
To test against the standard test set provided by iarna/toml:
```
% make
% cd test2
% bash build.sh # do this once
% bash run.sh # this will run the test suite
```

View file

View file

@ -2,7 +2,7 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
mkdir -p $DIR/goworkspace mkdir -p $DIR/goworkspace
export GOPATH=$DIR/goworkspace # if it isn't already set export GOPATH=$DIR/goworkspace
go get github.com/BurntSushi/toml-test # install test suite go get github.com/BurntSushi/toml-test # install test suite
go get github.com/BurntSushi/toml/cmd/toml-test-decoder # e.g., install my parser go get github.com/BurntSushi/toml/cmd/toml-test-decoder # e.g., install my parser
cp $GOPATH/bin/* . cp $GOPATH/bin/* .

1
test2/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/toml-spec-tests

6
test2/build.sh Normal file
View file

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

31
test2/run.sh Normal file
View file

@ -0,0 +1,31 @@
#
# 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]'
fi
done
#
# NEGATIVE tests
#
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
echo '[FAILED]'
fi
done

2870
toml.c

File diff suppressed because it is too large Load diff