From 40a44dc51f81f6911fe3e0adf24cf6040cd77701 Mon Sep 17 00:00:00 2001 From: Thomas Pelletier Date: Tue, 10 Dec 2013 14:43:27 +0100 Subject: [PATCH] Add BurntSushi's test suite --- .gitignore | 1 + test_program/go-test.sh | 6 ++++++ test_program/test_program.go | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 .gitignore create mode 100755 test_program/go-test.sh create mode 100644 test_program/test_program.go 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) + } +}