1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 16:33:03 +03:00

Add a (failing) test that multiple children on the same line get aligned.

This commit is contained in:
Rob Rix 2016-04-04 18:26:10 -04:00
parent d35de99307
commit 07cf5dac3c

View File

@ -105,6 +105,10 @@ spec = parallel $ do
(info 12 12 `branch` [])) (info 12 12 `branch` []))
] ]
it "aligns identical branches with multiple children on the same line" $
alignDiff (pure (Source.fromList "[ foo, bar, baz ]")) (pure (info 0 17) `branch` [ pure (info 2 5) `leaf` "foo", pure (info 7 10) `leaf` "bar", pure (info 12 15) `leaf` "baz" ]) `shouldBe`
[ Join (runBothWith These (pure (info 0 17 `branch` [ info 2 5 `leaf` "foo", info 7 10 `leaf` "bar", info 12 15 `leaf` "baz" ])) ) ]
where where
isOnSingleLine (a, _, _) = filter (/= '\n') (toString a) == toString a isOnSingleLine (a, _, _) = filter (/= '\n') (toString a) == toString a