From 083780220953adcc010b86cdd208a5153eaf35cf Mon Sep 17 00:00:00 2001 From: Arpad Ryszka Date: Sun, 26 Nov 2017 00:52:08 +0100 Subject: [PATCH] test choice/sequence preference --- parse_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/parse_test.go b/parse_test.go index 3ab0fb1..d41179a 100644 --- a/parse_test.go +++ b/parse_test.go @@ -710,3 +710,26 @@ func TestPartialRead(t *testing.T) { }}, ) } + +func TestChoiceSequencePriority(t *testing.T) { + runTests( + t, + `A = "a" | "b" "c"`, + []testItem{{ + title: "ac", + text: "ac", + fail: true, + }}, + ) + + runTests( + t, + `A = "a" | "b" "c"`, + []testItem{{ + title: "bc", + text: "bc", + ignorePosition: true, + node: &Node{Name: "A"}, + }}, + ) +}