summaryrefslogtreecommitdiff
path: root/parser_test.go
diff options
context:
space:
mode:
authorTed Kornish <tkornish@tableau.com>2018-03-01 11:11:40 -0800
committerTed Kornish <tkornish@tableau.com>2018-03-01 11:11:40 -0800
commit161cb77e537b14c0a460a072a360844391a9cde6 (patch)
treed02c9ae748f2aa7cf2998065e33e0a7ea95260d0 /parser_test.go
parent0f854720ca2bad30246020bb01cdb903a5f9406d (diff)
Add failing test for chars with a hyphen
Diffstat (limited to 'parser_test.go')
-rw-r--r--parser_test.go7
1 files changed, 7 insertions, 0 deletions
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())