Don't hang when reading an invalid rvalue (#77)

Fixes #76
This commit is contained in:
Thomas Pelletier
2016-06-30 16:21:25 +02:00
committed by GitHub
parent b39f6ef1f9
commit 64ff1ea4d5
3 changed files with 27 additions and 0 deletions
+14
View File
@@ -692,3 +692,17 @@ func TestInvalidFloat(t *testing.T) {
token{Position{1, 7}, tokenEOF, ""},
})
}
func TestLexUnknownRvalue(t *testing.T) {
testFlow(t, `a = !b`, []token{
token{Position{1, 1}, tokenKey, "a"},
token{Position{1, 3}, tokenEqual, "="},
token{Position{1, 5}, tokenError, "no value can start with !"},
})
testFlow(t, `a = \b`, []token{
token{Position{1, 1}, tokenKey, "a"},
token{Position{1, 3}, tokenEqual, "="},
token{Position{1, 5}, tokenError, `no value can start with \`},
})
}