From 161cb77e537b14c0a460a072a360844391a9cde6 Mon Sep 17 00:00:00 2001 From: Ted Kornish Date: Thu, 1 Mar 2018 11:11:40 -0800 Subject: [PATCH] Add failing test for chars with a hyphen --- parser_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/parser_test.go b/parser_test.go index aaed25f..b2e698c 100644 --- a/parser_test.go +++ b/parser_test.go @@ -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())