1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Test repetitions.

This commit is contained in:
Rob Rix 2017-04-07 09:44:13 -04:00
parent b8e4cb7471
commit d772a5c0aa

View File

@ -18,5 +18,8 @@ spec = do
it "matches in sequence" $ do
stepAssignment ((,) <$> comment <*> comment) [ast Comment "hello" [], ast Comment "world" []] `shouldBe` Just ([], (wrapU (Comment.Comment "hello"), wrapU (Comment.Comment "world")) :: (Program Syntax (), Program Syntax ()))
it "matches repetitions" $ do
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 ()])
ast :: Grammar -> ByteString -> [AST Grammar] -> AST Grammar
ast g s c = Rose (Node g s) c