From af542eff9e1e51561a9efa37685ee07b1d01b53e Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Thu, 10 Aug 2017 21:04:14 +1000 Subject: Add parse logging --- combinator_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'combinator_test.go') 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), ")") -- cgit v1.2.3