1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

🔥 the splitPatchByLines test.

This commit is contained in:
Rob Rix 2016-03-11 12:10:56 -05:00
parent ebd4cc7369
commit a22ac1ea31

View File

@ -108,14 +108,6 @@ spec = parallel $ do
\ source -> splitAbstractedTerm alignRows makeTerm (pure source) (pure $ Info (totalRange source) mempty) (Indexed []) `shouldBe` [
both (pure (makeTerm (Info (totalRange source) mempty) $ Indexed [], Range 0 (length source))) (pure (makeTerm (Info (totalRange source) mempty) $ Indexed [], Range 0 (length source))) ]
describe "splitPatchByLines" $ do
prop "starts at initial indices" $
\ patchConstructor sources ->
let indices = length <$> sources
ranges = (Range <$> indices <*> ((2 *) <$> indices))
patch = patchWithBoth patchConstructor (leafWithRangeInSource <$> sources <*> ranges) in
fmap start . maybeFirst . Maybe.catMaybes <$> Both.unzip (fmap maybeFirst . fmap (fmap Prelude.snd) <$> splitPatchByLines ((Source.++) <$> sources <*> sources) patch) `shouldBe` (<$) <$> indices <*> unPatch patchConstructor
where
isEmptyRow = and . fmap isEmpty