Add failing test for chars with a hyphen

This commit is contained in:
Ted Kornish 2018-03-01 11:11:40 -08:00
parent 0f854720ca
commit 161cb77e53

View File

@ -111,6 +111,13 @@ func TestChars(t *testing.T) {
require.False(t, ps.Errored())
})
t.Run("unescaped hyphen", func(t *testing.T) {
node, ps := runParser("19-", Chars("0-9"))
require.Equal(t, "19", node.Token)
require.Equal(t, 2, ps.Pos)
require.False(t, ps.Errored())
})
t.Run("no match", func(t *testing.T) {
_, ps := runParser("ffffff", Chars("0-9"))
require.Equal(t, "offset 0: expected 0-9", ps.Error.Error())