Add removed test
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user