Implement inline tables

This commit is contained in:
Thomas Pelletier
2015-08-19 10:24:53 -07:00
parent f58048cec0
commit dd4c4ffc2b
6 changed files with 131 additions and 16 deletions
+5 -12
View File
@@ -8,11 +8,12 @@ func testFlow(t *testing.T, input string, expectedFlow []token) {
token := <-ch
if token != expected {
t.Log("While testing: ", input)
t.Log("compared (got)", token, "to (expected)", expected)
t.Log("\tvalue:", token.val, "<->", expected.val)
t.Log("\ttype:", token.typ.String(), "<->", expected.typ.String())
t.Log("\tline:", token.Line, "<->", expected.Line)
t.Log("\tcolumn:", token.Col, "<->", expected.Col)
t.Log("compared", token, "to", expected)
t.Log(token.val, "<->", expected.val)
t.Log(token.typ, "<->", expected.typ)
t.Log(token.Line, "<->", expected.Line)
t.Log(token.Col, "<->", expected.Col)
t.FailNow()
}
}
@@ -371,14 +372,6 @@ func TestFloatWithExponent5(t *testing.T) {
})
}
func TestDoubleEqualKey(t *testing.T) {
testFlow(t, "foo= = 2", []token{
token{Position{1, 1}, tokenKey, "foo"},
token{Position{1, 4}, tokenEqual, "="},
token{Position{1, 5}, tokenError, "cannot have multiple equals for the same key"},
})
}
func TestInvalidEsquapeSequence(t *testing.T) {
testFlow(t, `foo = "\x"`, []token{
token{Position{1, 1}, tokenKey, "foo"},