1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

Test the specific error message we get for cascading children failures.

This commit is contained in:
Rob Rix 2017-04-26 11:45:58 -04:00
parent d57df3f5fb
commit e89ea96739

View File

@ -51,8 +51,7 @@ spec = do
() <$ runAssignment (children red) (startingState "a" [Rose (rec Blue 0 1) [Rose (rec Red 0 1) []]]) `shouldBe` Result ()
it "does not match if its subrule does not match" $
let errors r = case r of { Result _ -> Nothing ; Error e -> Just e } in
fmap Prologue.length (errors (runAssignment (children red) (startingState "a" [Rose (rec Blue 0 1) [Rose (rec Green 0 1) []]]))) `shouldBe` Just 1
(runAssignment (children red) (startingState "a" [Rose (rec Blue 0 1) [Rose (rec Green 0 1) []]])) `shouldBe` Error [ "Expected Red but got Green" ]
it "matches nested children" $ do
runAssignment