Add BurntSushi's test suite
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f1b6190 --- /dev/null +++ b/.gitignore
@@ -0,0 +1 @@ +test_program/test_program_bin
diff --git a/test_program/go-test.sh b/test_program/go-test.sh new file mode 100755 index 0000000..10043aa --- /dev/null +++ b/test_program/go-test.sh
@@ -0,0 +1,6 @@ +#!/bin/bash + +go get github.com/BurntSushi/toml-test # install test suite +go get github.com/BurntSushi/toml/toml-test-go # install my parser +go build -o test_program_bin github.com/pelletier/go-toml/test_program +$GOPATH/bin/toml-test ./test_program_bin # run tests on my parser
diff --git a/test_program/test_program.go b/test_program/test_program.go new file mode 100644 index 0000000..8f9da83 --- /dev/null +++ b/test_program/test_program.go
@@ -0,0 +1,20 @@ +package main + +import ( + "io/ioutil" + "os" + "github.com/pelletier/go-toml" +) + +func main() { + bytes, err := ioutil.ReadAll(os.Stdin) + if err != nil { + os.Exit(2) + } + _, err = toml.Load(string(bytes)) + if err == nil { + os.Exit(0) + } else { + os.Exit(1) + } +}