From c2482a061063e8a979256721be3fbf4df1c4bf31 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 10 Apr 2017 10:35:39 -0400 Subject: [PATCH] Test that children assignments nest. --- test/Data/Syntax/Assignment/Spec.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/Data/Syntax/Assignment/Spec.hs b/test/Data/Syntax/Assignment/Spec.hs index ec5b1a466..300453e7b 100644 --- a/test/Data/Syntax/Assignment/Spec.hs +++ b/test/Data/Syntax/Assignment/Spec.hs @@ -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