1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Test one-or-more repetition.

This commit is contained in:
Rob Rix 2017-04-07 09:48:21 -04:00
parent ad0fa60a3e
commit 38466c64e0

View File

@ -21,5 +21,8 @@ spec = do
it "matches repetitions" $
stepAssignment (many comment) [ast Comment "colourless" [], ast Comment "green" [], ast Comment "ideas" [], ast Comment "sleep" [], ast Comment "furiously" []] `shouldBe` Just ([], [wrapU (Comment.Comment "colourless"), wrapU (Comment.Comment "green"), wrapU (Comment.Comment "ideas"), wrapU (Comment.Comment "sleep"), wrapU (Comment.Comment "furiously")] :: [Program Syntax ()])
it "matches one-or-more repetitions against one or more input nodes" $
stepAssignment (some comment) [ast Comment "hello" []] `shouldBe` Just ([], [wrapU (Comment.Comment "hello")] :: [Program Syntax ()])
ast :: Grammar -> ByteString -> [AST Grammar] -> AST Grammar
ast g s c = Rose (Node g s) c