Skip to content

Commit

Permalink
Add test to reproduce issue 29.
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntSushi committed May 12, 2014
1 parent 890ff2d commit 79bdfaa
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,24 @@ import (
"testing"
)

func TestUnexported(t *testing.T) {
type unexported struct {
unexported int
}
enc := NewEncoder(new(bytes.Buffer))
if err := enc.Encode(&unexported{0}); err != nil {
t.Fatalf("Unexported fields should be ignored when encoding.")
}
}

// XXX(burntsushi)
// I think these tests probably should be removed. They are good, but they
// ought to be obsolete by toml-test.
func TestEncode(t *testing.T) {
type Embedded struct {
Int int `toml:"_int"`
}

tests := map[string]struct {
input interface{}
wantOutput string
Expand Down Expand Up @@ -276,7 +290,3 @@ ArrayOfMixedSlices = [[1, 2], ["a", "b"]]`,
}
}
}

type Embedded struct {
Int int `toml:"_int"`
}

0 comments on commit 79bdfaa

Please sign in to comment.