mirror of
https://github.com/github/semantic.git
synced 2024-12-29 09:55:52 +03:00
Test that we align insertions into empty branches without losing nodes.
This commit is contained in:
parent
6f819341ab
commit
e40434f476
@ -101,6 +101,12 @@ spec = parallel $ do
|
||||
align sources (Pure (Insert (info 0 1 :< Leaf "a"))) `shouldBe` PrettyDiff sources
|
||||
[ Join (That (Pure (SplitInsert (info 0 1 :< Leaf "a")))) ]
|
||||
|
||||
it "aligns insertions into empty branches" $
|
||||
let sources = both (Source.fromList "") (Source.fromList "a") in
|
||||
align sources (both (info 0 0) (info 0 1) `branch` [ Pure (Insert (info 0 1 :< Leaf "a")) ]) `shouldBe` PrettyDiff sources
|
||||
[ Join (These (info 0 0 `branch` [])
|
||||
(info 0 1 `branch` [ Pure (SplitInsert (info 0 1 :< Leaf "a")) ])) ]
|
||||
|
||||
it "aligns context following insertions" $
|
||||
let sources = both (Source.fromList "a\nc") (Source.fromList "a\nb\nc") in
|
||||
align sources (both (info 0 3) (info 0 5) `branch` [ pure (info 0 1) `leaf` "a", Pure (Insert (info 2 3 :< Leaf "b")), both (info 2 3) (info 4 5) `leaf` "c" ])
|
||||
|
Loading…
Reference in New Issue
Block a user