diff options
Diffstat (limited to 'combinator_test.go')
-rw-r--r-- | combinator_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/combinator_test.go b/combinator_test.go index 283bb2a..5ac227f 100644 --- a/combinator_test.go +++ b/combinator_test.go @@ -162,6 +162,15 @@ func TestBind(t *testing.T) { }) } +func TestCut(t *testing.T) { + // does backtracking happen anywhere else? + t.Run("test any", func(t *testing.T) { + _, ps := runParser("var world", Any(Seq("var", Cut, "hello"), "var world")) + require.Equal(t, "offset 4: expected hello", ps.Error.Error()) + require.Equal(t, 0, ps.Pos) + }) +} + func TestMerge(t *testing.T) { var bracer Parser bracer = Seq("(", Maybe(&bracer), ")") |