Add removed test

This commit is contained in:
Thomas Pelletier
2015-09-09 17:01:05 +01:00
parent dd4c4ffc2b
commit 821a80e635
2 changed files with 10 additions and 0 deletions
+3
View File
@@ -171,6 +171,7 @@ func (p *tomlParser) parseGroup() tomlParserStateFn {
func (p *tomlParser) parseAssign() tomlParserStateFn {
key := p.getToken()
p.assume(tokenEqual)
value := p.parseRvalue()
var groupKey []string
if len(p.currentGroup) > 0 {
@@ -246,6 +247,8 @@ func (p *tomlParser) parseRvalue() interface{} {
return p.parseArray()
case tokenLeftCurlyBrace:
return p.parseInlineTable()
case tokenEqual:
p.raiseError(tok, "cannot have multiple equals for the same key")
case tokenError:
p.raiseError(tok, "%s", tok)
}
+7
View File
@@ -571,3 +571,10 @@ func TestInvalidGroupArray(t *testing.T) {
t.Error("Should error")
}
}
func TestDoubleEqual(t *testing.T) {
_, err := Load("foo= = 2")
if err.Error() != "(1, 6): cannot have multiple equals for the same key" {
t.Error("Bad error message:", err.Error())
}
}