2 # fail out of the script if anything here fails
5 # set the path to the present working directory
12 if [ ! -d "src/$path" ]; then
14 git clone https://$path.git src/$path
17 git checkout "$branch"
18 git reset --hard "$version"
22 # Remove potential previous runs
23 rm -rf src test_program_bin toml-test
28 go get github.com/pelletier/go-buffruneio
29 go get github.com/davecgh/go-spew/spew
30 go get gopkg.in/yaml.v2
31 go get github.com/BurntSushi/toml
33 # get code for BurntSushi TOML validation
34 # pinning all to 'HEAD' for version 0.3.x work (TODO: pin to commit hash when tests stabilize)
35 git_clone github.com/BurntSushi/toml master HEAD
36 git_clone github.com/BurntSushi/toml-test master HEAD #was: 0.2.0 HEAD
38 # build the BurntSushi test application
39 go build -o toml-test github.com/BurntSushi/toml-test
41 # vendorize the current lib for testing
42 # NOTE: this basically mocks an install without having to go back out to github for code
43 mkdir -p src/github.com/pelletier/go-toml/cmd
44 mkdir -p src/github.com/pelletier/go-toml/query
45 cp *.go *.toml src/github.com/pelletier/go-toml
46 cp -R cmd/* src/github.com/pelletier/go-toml/cmd
47 cp -R query/* src/github.com/pelletier/go-toml/query
48 go build -o test_program_bin src/github.com/pelletier/go-toml/cmd/test_program.go
50 # Run basic unit tests
51 go test github.com/pelletier/go-toml -covermode=count -coverprofile=coverage.out
52 go test github.com/pelletier/go-toml/cmd/tomljson
53 go test github.com/pelletier/go-toml/query
55 # run the entire BurntSushi test suite
56 if [[ $# -eq 0 ]] ; then
57 echo "Running all BurntSushi tests"
58 ./toml-test ./test_program_bin | tee test_out
62 test_path='src/github.com/BurntSushi/toml-test/tests'
63 valid_test="$test_path/valid/$test"
64 invalid_test="$test_path/invalid/$test"
66 if [ -e "$valid_test.toml" ]; then
67 echo "Valid Test TOML for $test:"
69 cat "$valid_test.toml"
71 echo "Valid Test JSON for $test:"
73 cat "$valid_test.json"
75 echo "Go-TOML Output for $test:"
77 cat "$valid_test.toml" | ./test_program_bin
80 if [ -e "$invalid_test.toml" ]; then
81 echo "Invalid Test TOML for $test:"
83 cat "$invalid_test.toml"
85 echo "Go-TOML Output for $test:"
87 echo "go-toml Output:"
88 cat "$invalid_test.toml" | ./test_program_bin