Skip to content

Commit

Permalink
Some small reorg to clean things up.
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntSushi committed May 16, 2014
1 parent 1d45db7 commit 23702f4
Show file tree
Hide file tree
Showing 16 changed files with 13 additions and 39 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ install:
- go get github.com/BurntSushi/toml-test
script:
- export PATH="$PATH:$HOME/gopath/bin"
- go test -v
- toml-test toml-test-go
- toml-test -encoder toml-test-encoder
- make test

7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
install:
go install
go install ./...

test:
go test -v
toml-test toml-test-decoder
toml-test -encoder toml-test-encoder

fmt:
gofmt -w *.go */*.go
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 1 addition & 8 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,10 @@ type simple struct {
func TestDecode(t *testing.T) {
var val simple

md, err := Decode(testSimple, &val)
_, err := Decode(testSimple, &val)
if err != nil {
t.Fatal(err)
}

testf("Is 'Annoying.Cats.plato' defined? %v\n",
md.IsDefined("Annoying", "Cats", "plato"))
testf("Is 'Cats.Stinky' defined? %v\n", md.IsDefined("Cats", "Stinky"))
testf("Type of 'colors'? %s\n\n", md.Type("colors"))

testf("%v\n", val)
}

func TestDecodeEmbedded(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ func TestEncode(t *testing.T) {
wantOutput: fmt.Sprintf("Date = %s", dateStr),
},
"datetime field as primitive": {
// Using a map here to fail if isStructOrMap() returns true for time.Time.
// Using a map here to fail if isStructOrMap() returns true for
// time.Time.
input: map[string]interface{}{
"Date": date,
"Int": 1,
Expand All @@ -98,7 +99,8 @@ func TestEncode(t *testing.T) {
input: struct{ DatetimeSlice []time.Time }{
[]time.Time{date, date},
},
wantOutput: fmt.Sprintf("DatetimeSlice = [%s, %s]", dateStr, dateStr),
wantOutput: fmt.Sprintf("DatetimeSlice = [%s, %s]",
dateStr, dateStr),
},
"nested arrays and slices": {
input: struct {
Expand Down
1 change: 0 additions & 1 deletion lex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ func TestLexer(t *testing.T) {
} else if item.typ == itemError {
t.Fatal(item.val)
}
testf("%s\n", item)
}
}
19 changes: 0 additions & 19 deletions out_test.go

This file was deleted.

6 changes: 1 addition & 5 deletions parse_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package toml

import (
"strings"
"testing"
)

Expand Down Expand Up @@ -49,13 +48,10 @@ func TestParse(t *testing.T) {
}

func printMap(m map[string]interface{}, depth int) {
for k, v := range m {
testf("%s%s\n", strings.Repeat(" ", depth), k)
for _, v := range m {
switch subm := v.(type) {
case map[string]interface{}:
printMap(subm, depth+1)
default:
testf("%s%v\n", strings.Repeat(" ", depth+1), v)
}
}
}
Expand Down

0 comments on commit 23702f4

Please sign in to comment.