Add failing test for chars with a hyphen
This commit is contained in:
parent
0f854720ca
commit
161cb77e53
@ -111,6 +111,13 @@ func TestChars(t *testing.T) {
|
|||||||
require.False(t, ps.Errored())
|
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) {
|
t.Run("no match", func(t *testing.T) {
|
||||||
_, ps := runParser("ffffff", Chars("0-9"))
|
_, ps := runParser("ffffff", Chars("0-9"))
|
||||||
require.Equal(t, "offset 0: expected 0-9", ps.Error.Error())
|
require.Equal(t, "offset 0: expected 0-9", ps.Error.Error())
|
||||||
|
Loading…
Reference in New Issue
Block a user