Skip to content

Commit

Permalink
Fixes BurntSushi#42.
Browse files Browse the repository at this point in the history
This was actually fixed in commit 44d4af for BurntSushi#43, but this adds a
regression test from BurntSushi#42.
  • Loading branch information
BurntSushi committed Jun 11, 2014
1 parent 44d4af0 commit dbf2b1d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,28 @@ func TestEncodeNestedTableArrays(t *testing.T) {
encodeExpected(t, "nested table arrays", value, expected, nil)
}

func TestEncodeArrayHashWithNormalHashOrder(t *testing.T) {
type Alpha struct {
V int
}
type Beta struct {
V int
}
type Conf struct {
V int
A Alpha
B []Beta
}

val := Conf{
V: 1,
A: Alpha{2},
B: []Beta{{3}},
}
expected := "V = 1\n\n[A]\n V = 2\n\n[[B]]\n V = 3\n"
encodeExpected(t, "array hash with normal hash order", val, expected, nil)
}

func encodeExpected(
t *testing.T, label string, val interface{}, wantStr string, wantErr error,
) {
Expand Down

0 comments on commit dbf2b1d

Please sign in to comment.