1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00

Test that we produce unchanged entries for identity diffs.

This commit is contained in:
Rob Rix 2017-05-11 10:02:18 -04:00
parent 8a86d27f7c
commit f7bc08427a

View File

@ -6,6 +6,7 @@ import Data.Aeson
import Category as C import Category as C
import Data.Functor.Both import Data.Functor.Both
import Data.Functor.Listable import Data.Functor.Listable
import Data.Maybe (fromJust)
import Data.Record import Data.Record
import Data.Text.Listable import Data.Text.Listable
import Diff import Diff
@ -37,6 +38,9 @@ spec = parallel $ do
prop "includes all nodes with a constant Just function" $ prop "includes all nodes with a constant Just function" $
\ diff -> let diff' = (unListableDiff diff :: Diff (Syntax ()) ()) in entryValue <$> tableOfContentsBy (const (Just ())) diff' `shouldBe` replicate (diffSize diff') () \ diff -> let diff' = (unListableDiff diff :: Diff (Syntax ()) ()) in entryValue <$> tableOfContentsBy (const (Just ())) diff' `shouldBe` replicate (diffSize diff') ()
prop "produces an unchanged entry for identity diffs" $
\ term -> let term' = (unListableF term :: Term (Syntax ()) (Record '[Category])) in tableOfContentsBy (Just . headF) (diffTerms term' term') `shouldBe` [Unchanged (fromJust (getLast (foldMap (Last . Just) term')))]
describe "diffTOC" $ do describe "diffTOC" $ do
it "blank if there are no methods" $ it "blank if there are no methods" $
diffTOC blankDiffBlobs blankDiff `shouldBe` [ ] diffTOC blankDiffBlobs blankDiff `shouldBe` [ ]