mirror of
https://github.com/github/semantic.git
synced 2024-11-29 02:44:36 +03:00
Remove redundant parentheses.
This commit is contained in:
parent
c0a566be4a
commit
671904cf61
@ -95,7 +95,7 @@ spec = do
|
|||||||
it "should split multi-line deletions across multiple rows" $
|
it "should split multi-line deletions across multiple rows" $
|
||||||
let (sourceA, sourceB) = ("/*\n*/\na", "a") in
|
let (sourceA, sourceB) = ("/*\n*/\na", "a") in
|
||||||
annotatedToRows (formatted sourceA sourceB "branch" (Indexed [
|
annotatedToRows (formatted sourceA sourceB "branch" (Indexed [
|
||||||
Pure . Delete $ (Info (Range 0 5) (Set.fromList ["leaf"]) :< (Leaf "")),
|
Pure . Delete $ (Info (Range 0 5) (Set.fromList ["leaf"]) :< Leaf ""),
|
||||||
Free . offsetAnnotated 6 0 $ unchanged "a" "leaf" (Leaf "")
|
Free . offsetAnnotated 6 0 $ unchanged "a" "leaf" (Leaf "")
|
||||||
])) sourceA sourceB `shouldBe`
|
])) sourceA sourceB `shouldBe`
|
||||||
([
|
([
|
||||||
@ -107,7 +107,7 @@ spec = do
|
|||||||
describe "unicode" $
|
describe "unicode" $
|
||||||
it "equivalent precomposed and decomposed characters are not equal" $
|
it "equivalent precomposed and decomposed characters are not equal" $
|
||||||
let (sourceA, sourceB) = ("t\776", "\7831")
|
let (sourceA, sourceB) = ("t\776", "\7831")
|
||||||
syntax = Leaf . Pure $ Replace (info sourceA "leaf" :< (Leaf "")) (info sourceB "leaf" :< (Leaf ""))
|
syntax = Leaf . Pure $ Replace (info sourceA "leaf" :< Leaf "") (info sourceB "leaf" :< Leaf "")
|
||||||
in
|
in
|
||||||
annotatedToRows (formatted sourceA sourceB "leaf" syntax) sourceA sourceB `shouldBe`
|
annotatedToRows (formatted sourceA sourceB "leaf" syntax) sourceA sourceB `shouldBe`
|
||||||
([ Row (Line False [ span "t\776" ]) (Line False [ span "\7831"]) ], (Range 0 2, Range 0 1))
|
([ Row (Line False [ span "t\776" ]) (Line False [ span "\7831"]) ], (Range 0 2, Range 0 1))
|
||||||
@ -118,25 +118,25 @@ spec = do
|
|||||||
\ a -> adjoinRowsBy openElement [] a == [ a ]
|
\ a -> adjoinRowsBy openElement [] a == [ a ]
|
||||||
|
|
||||||
prop "appends onto open rows" $
|
prop "appends onto open rows" $
|
||||||
forAll ((arbitrary `suchThat` isOpen) >>= \ a -> ((,) a) <$> (arbitrary `suchThat` isOpen)) $
|
forAll ((arbitrary `suchThat` isOpen) >>= \ a -> (,) a <$> (arbitrary `suchThat` isOpen)) $
|
||||||
\ (a@(Row (Line ac1 as1) (Line bc1 bs1)), b@(Row (Line ac2 as2) (Line bc2 bs2))) ->
|
\ (a@(Row (Line ac1 as1) (Line bc1 bs1)), b@(Row (Line ac2 as2) (Line bc2 bs2))) ->
|
||||||
adjoinRowsBy openElement [ a ] b `shouldBe` [ Row (Line (ac1 || ac2) $ as1 ++ as2) (Line (bc1 || bc2) $ bs1 ++ bs2) ]
|
adjoinRowsBy openElement [ a ] b `shouldBe` [ Row (Line (ac1 || ac2) $ as1 ++ as2) (Line (bc1 || bc2) $ bs1 ++ bs2) ]
|
||||||
|
|
||||||
prop "does not append onto closed rows" $
|
prop "does not append onto closed rows" $
|
||||||
forAll ((arbitrary `suchThat` isClosed) >>= \ a -> ((,) a) <$> (arbitrary `suchThat` isClosed)) $
|
forAll ((arbitrary `suchThat` isClosed) >>= \ a -> (,) a <$> (arbitrary `suchThat` isClosed)) $
|
||||||
\ (a, b) -> adjoinRowsBy openElement [ a ] b `shouldBe` [ b, a ]
|
\ (a, b) -> adjoinRowsBy openElement [ a ] b `shouldBe` [ b, a ]
|
||||||
|
|
||||||
prop "does not promote elements through empty lines onto closed lines" $
|
prop "does not promote elements through empty lines onto closed lines" $
|
||||||
forAll ((arbitrary `suchThat` isClosed) >>= \ a -> ((,) a) <$> (arbitrary `suchThat` isClosed)) $
|
forAll ((arbitrary `suchThat` isClosed) >>= \ a -> (,) a <$> (arbitrary `suchThat` isClosed)) $
|
||||||
\ (a, b) -> adjoinRowsBy openElement [ Row EmptyLine EmptyLine, a ] b `shouldBe` [ b, Row EmptyLine EmptyLine, a ]
|
\ (a, b) -> adjoinRowsBy openElement [ Row EmptyLine EmptyLine, a ] b `shouldBe` [ b, Row EmptyLine EmptyLine, a ]
|
||||||
|
|
||||||
prop "promotes elements through empty lines onto open lines" $
|
prop "promotes elements through empty lines onto open lines" $
|
||||||
forAll ((arbitrary `suchThat` isOpen) >>= \ a -> ((,) a) <$> (arbitrary `suchThat` isOpen)) $
|
forAll ((arbitrary `suchThat` isOpen) >>= \ a -> (,) a <$> (arbitrary `suchThat` isOpen)) $
|
||||||
\ (a, b) -> adjoinRowsBy openElement [ Row EmptyLine EmptyLine, a ] b `shouldBe` Row EmptyLine EmptyLine : adjoinRowsBy openElement [ a ] b
|
\ (a, b) -> adjoinRowsBy openElement [ Row EmptyLine EmptyLine, a ] b `shouldBe` Row EmptyLine EmptyLine : adjoinRowsBy openElement [ a ] b
|
||||||
|
|
||||||
describe "termToLines" $ do
|
describe "termToLines" $ do
|
||||||
it "splits multi-line terms into multiple lines" $
|
it "splits multi-line terms into multiple lines" $
|
||||||
termToLines (Info (Range 0 5) (Set.singleton "leaf") :< (Leaf "")) "/*\n*/"
|
termToLines (Info (Range 0 5) (Set.singleton "leaf") :< Leaf "") "/*\n*/"
|
||||||
`shouldBe`
|
`shouldBe`
|
||||||
([
|
([
|
||||||
Line True [ span "/*", Break ],
|
Line True [ span "/*", Break ],
|
||||||
|
Loading…
Reference in New Issue
Block a user