summaryrefslogtreecommitdiff
path: root/combinator_test.go
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-10 21:04:14 +1000
committerAdam Scarr <adam@vektah.net>2017-08-10 21:08:18 +1000
commitaf542eff9e1e51561a9efa37685ee07b1d01b53e (patch)
treec700bdca58b4f9bbeb89ba1b102b2a779c88f7f3 /combinator_test.go
parentb64fcfaa6115eb4a5f65c12d37f95d842136ae35 (diff)
Add parse logging
Diffstat (limited to 'combinator_test.go')
-rw-r--r--combinator_test.go9
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), ")")