1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

Move the rule assignment tests down.

This commit is contained in:
Rob Rix 2017-04-07 14:50:57 -04:00
parent f082473b4f
commit 0cc5c84706

View File

@ -6,10 +6,6 @@ import Test.Hspec
spec :: Spec spec :: Spec
spec = do spec = do
describe "rule" $ do
it "matches nodes" $
runAssignment red [ast Red "hello" []] `shouldBe` Just ([], Out "hello")
describe "Applicative" $ do describe "Applicative" $ do
it "matches in sequence" $ it "matches in sequence" $
runAssignment ((,) <$> red <*> red) [ast Red "hello" [], ast Red "world" []] `shouldBe` Just ([], (Out "hello", Out "world")) runAssignment ((,) <$> red <*> red) [ast Red "hello" [], ast Red "world" []] `shouldBe` Just ([], (Out "hello", Out "world"))
@ -24,6 +20,10 @@ spec = do
it "matches one-or-more repetitions against one or more input nodes" $ it "matches one-or-more repetitions against one or more input nodes" $
runAssignment (some red) [ast Red "hello" []] `shouldBe` Just ([], [Out "hello"]) runAssignment (some red) [ast Red "hello" []] `shouldBe` Just ([], [Out "hello"])
describe "rule" $ do
it "matches nodes with the same symbol" $
runAssignment red [ast Red "hello" []] `shouldBe` Just ([], Out "hello")
describe "children" $ do describe "children" $ do
it "advances past the current node" $ it "advances past the current node" $
fst <$> runAssignment (children (pure (Out ""))) [ast Red "a" []] `shouldBe` Just [] fst <$> runAssignment (children (pure (Out ""))) [ast Red "a" []] `shouldBe` Just []