Skip to content

Commit

Permalink
Modify rep-test to account for repetition of a concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
aengelberg committed May 2, 2016
1 parent 193bece commit 5f3f27b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test/instaparse/abnf_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,28 @@ to test the lookahead"
(def reps
"Testing the different kinds of repetitions"
(parser
"S = A B C D E
"S = A B C D E FG
A = *'a'
B = 2*'b'
C = *2'c'
D = 2'd'
E = 2*4'e'"
E = 2*4'e'
FG = 2('f' 'g')"
:input-format :abnf))

(deftest rep-test
(are [x] (not (instance? instaparse.gll.Failure x))
(reps "aabbccddee")
(reps "bbbbbbddeeee")
(reps "bbcddee")))
(reps "aabbccddeefgfg")
(reps "bbbbbbddeeeefgfg")
(reps "bbcddeefgfg")))

(deftest rep-test-errors
(are [x] (instance? instaparse.gll.Failure x)
(reps "")
(reps "bccddee")
(reps "aaaabbbbcccddee")))
(reps "bccddeefgfg")
(reps "aaaabbbbcccddeefgfg")
(reps "aabbccddeefg")
(reps "aabbccddeeffgg")))

(def regex-chars
"Testing %d42-91. The boundary chars are \"*\" and \"[\", which normally aren't allowed in a regex."
Expand Down

0 comments on commit 5f3f27b

Please sign in to comment.