diff --git a/decode_test.go b/decode_test.go index 3f529fa8..0c36b33e 100644 --- a/decode_test.go +++ b/decode_test.go @@ -937,6 +937,34 @@ func TestDecodeErrors(t *testing.T) { } } +// Test for https://github.com/BurntSushi/toml/pull/166. +func TestDecodeBoolArray(t *testing.T) { + for _, tt := range []struct { + s string + got interface{} + want interface{} + }{ + { + "a = [true, false]", + &struct{ A []bool }{}, + &struct{ A []bool }{[]bool{true, false}}, + }, + { + "a = {a = true, b = false}", + &struct{ A map[string]bool }{}, + &struct{ A map[string]bool }{map[string]bool{"a": true, "b": false}}, + }, + } { + if _, err := Decode(tt.s, tt.got); err != nil { + t.Errorf("Decode(%q): %s", tt.s, err) + continue + } + if !reflect.DeepEqual(tt.got, tt.want) { + t.Errorf("Decode(%q): got %#v; want %#v", tt.s, tt.got, tt.want) + } + } +} + func ExampleMetaData_PrimitiveDecode() { var md MetaData var err error diff --git a/lex.go b/lex.go index f1f4b2de..6dee7fc7 100644 --- a/lex.go +++ b/lex.go @@ -840,7 +840,7 @@ func lexBool(lx *lexer) stateFn { var rs []rune for { r := lx.next() - if r == eof || isWhitespace(r) || isNL(r) { + if !unicode.IsLetter(r) { lx.backup() break }