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

Test openLineBy over openTerm.

This commit is contained in:
Rob Rix 2015-12-21 20:04:05 -05:00
parent 60edd3b19a
commit d1abf65cdd

View File

@ -160,11 +160,22 @@ spec = do
Line True [ Div (Just "delete") [ span "/*", Break ] ] Line True [ Div (Just "delete") [ span "/*", Break ] ]
] `shouldBe` (Just $ Line True [ Div (Just "delete") [ span "*/" ] ]) ] `shouldBe` (Just $ Line True [ Div (Just "delete") [ span "*/" ] ])
it "should produce the earliest non-empty line in a list, if open" $
openLineBy (openTerm "\n ") [
Line True [ Info (Range 1 2) mempty :< Leaf "" ],
Line True [ Info (Range 0 1) mempty :< Leaf "" ]
] `shouldBe` (Just $ Line True [ Info (Range 1 2) mempty :< Leaf "" ])
it "should return Nothing if the earliest non-empty line is closed" $ it "should return Nothing if the earliest non-empty line is closed" $
openLineBy openElement [ openLineBy openElement [
Line True [ Div (Just "delete") [ span " * Debugging", Break ] ] Line True [ Div (Just "delete") [ span " * Debugging", Break ] ]
] `shouldBe` Nothing ] `shouldBe` Nothing
it "should return Nothing if the earliest non-empty line is closed" $
openLineBy (openTerm "\n") [
Line True [ Info (Range 0 1) mempty :< Leaf "" ]
] `shouldBe` Nothing
where where
rightRowText text = rightRow [ Text text ] rightRowText text = rightRow [ Text text ]
rightRow xs = Row EmptyLine (Line False xs) rightRow xs = Row EmptyLine (Line False xs)