mirror of
https://github.com/github/semantic.git
synced 2024-12-29 18:06:14 +03:00
Test that children assignments nest.
This commit is contained in:
parent
c9cf3d0bb8
commit
c2482a0610
@ -46,6 +46,13 @@ spec = do
|
||||
it "does not match if its subrule does not match" $
|
||||
runAssignment (children red) [ast Blue "b" [ast Green "a" []]] `shouldBe` Nothing
|
||||
|
||||
it "matches nested children" $ do
|
||||
runAssignment
|
||||
(rule 'A' *> children (rule 'B' *> children (rule 'C' *> content)))
|
||||
[ ast 'A' "" [ ast 'B' "" [ ast 'C' "1" [] ] ] ]
|
||||
`shouldBe`
|
||||
Just ([], "1")
|
||||
|
||||
ast :: grammar -> ByteString -> [AST grammar] -> AST grammar
|
||||
ast g s c = Rose (Node g s) c
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user