1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 08:25:19 +03:00

Correct the tests.

This commit is contained in:
Rob Rix 2017-09-13 09:45:10 -04:00
parent 7e0c9aaaea
commit e36034455c
2 changed files with 6 additions and 3 deletions

View File

@ -180,7 +180,9 @@ instance Listable1 f => Listable1 (BindingF f) where
instance Listable1 f => Listable2 (DiffF f) where instance Listable1 f => Listable2 (DiffF f) where
liftTiers2 annTiers recurTiers = liftCons1 (liftTiers2 annTiers recurTiers) Either \/ liftCons1 (liftTiers2 (liftTiers2 annTiers annTiers) recurTiers) Both \/ liftCons1 (liftTiers2 (liftTiers2 annTiers annTiers) recurTiers) Merge liftTiers2 annTiers recurTiers
= liftCons1 (liftTiers (liftTiers2 annTiers recurTiers)) Patch
\/ liftCons1 (liftTiers2 (liftTiers2 annTiers annTiers) recurTiers) Merge
instance (Listable1 f, Listable a) => Listable1 (DiffF f a) where instance (Listable1 f, Listable a) => Listable1 (DiffF f a) where
liftTiers = liftTiers2 tiers liftTiers = liftTiers2 tiers

View File

@ -7,6 +7,7 @@ import Data.Functor.Both as Both
import Data.Functor.Sum import Data.Functor.Sum
import Diff import Diff
import Language import Language
import Patch
import Renderer import Renderer
import Semantic import Semantic
import Semantic.Task import Semantic.Task
@ -33,11 +34,11 @@ spec = parallel $ do
describe "diffTermPair" $ do describe "diffTermPair" $ do
it "produces an Insert when the first blob is missing" $ do it "produces an Insert when the first blob is missing" $ do
result <- runTask (diffTermPair (both (emptyBlob "/foo") (sourceBlob "/foo" Nothing "")) (runBothWith replacing) (pure (termIn () []))) result <- runTask (diffTermPair (both (emptyBlob "/foo") (sourceBlob "/foo" Nothing "")) (runBothWith replacing) (pure (termIn () [])))
result `shouldBe` Diff (Let mempty (Either (In () (InR [])))) result `shouldBe` Diff (Let mempty (Patch (Insert (In () []))))
it "produces a Delete when the second blob is missing" $ do it "produces a Delete when the second blob is missing" $ do
result <- runTask (diffTermPair (both (sourceBlob "/foo" Nothing "") (emptyBlob "/foo")) (runBothWith replacing) (pure (termIn () []))) result <- runTask (diffTermPair (both (sourceBlob "/foo" Nothing "") (emptyBlob "/foo")) (runBothWith replacing) (pure (termIn () [])))
result `shouldBe` Diff (Let mempty (Either (In () (InL [])))) result `shouldBe` Diff (Let mempty (Patch (Delete (In () []))))
where where
methodsBlob = Blob "def foo\nend\n" "ff7bbbe9495f61d9e1e58c597502d152bab1761e" "methods.rb" (Just defaultPlainBlob) (Just Ruby) methodsBlob = Blob "def foo\nend\n" "ff7bbbe9495f61d9e1e58c597502d152bab1761e" "methods.rb" (Just defaultPlainBlob) (Just Ruby)