mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
Test that symmetrical nodes force alignment of earlier asymmetrical nodes on the same line.
This commit is contained in:
parent
5c2d9b6b01
commit
7d591e737f
@ -118,6 +118,12 @@ spec = parallel $ do
|
||||
(info 4 5 `branch` [ info 4 5 `leaf` "c" ]))
|
||||
]
|
||||
|
||||
it "symmetrical nodes force the alignment of preceding coincident asymmetrical nodes" $
|
||||
let sources = both (Source.fromList "[ a, b ]") (Source.fromList "[ b ]") in
|
||||
align sources (both (info 0 8) (info 0 5) `branch` [ Pure (Delete (info 2 3 :< Leaf "a")), both (info 5 6) (info 2 3) `leaf` "b" ]) `shouldBe` PrettyDiff sources
|
||||
[ Join (These (info 0 8 `branch` [ Pure (SplitDelete (info 2 3 :< Leaf "a")), info 5 6 `leaf` "b" ])
|
||||
(info 0 5 `branch` [ info 2 3 `leaf` "b" ])) ]
|
||||
|
||||
describe "numberedRows" $
|
||||
prop "counts only non-empty values" $
|
||||
\ xs -> counts (numberedRows (xs :: [Join These Char])) `shouldBe` length . catMaybes <$> Join (unalign (runJoin <$> xs))
|
||||
|
Loading…
Reference in New Issue
Block a user