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

Correct the tests.

This commit is contained in:
Rob Rix 2017-05-11 16:37:08 -04:00
parent f2ca4b5144
commit 1f653470d1

View File

@ -9,6 +9,7 @@ import Data.Functor.Listable
import Data.Maybe (fromJust) import Data.Maybe (fromJust)
import Data.Record import Data.Record
import Data.Text.Listable import Data.Text.Listable
import Data.These
import Diff import Diff
import Info import Info
import Interpreter import Interpreter
@ -42,8 +43,8 @@ spec = parallel $ do
prop "produces an unchanged entry for identity diffs" $ 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 (lastValue term')] \ term -> let term' = (unListableF term :: Term (Syntax ()) (Record '[Category])) in tableOfContentsBy (Just . headF) (diffTerms term' term') `shouldBe` [Unchanged (lastValue term')]
prop "produces patched entries for relevant nodes within patches" $ prop "produces inserted/deleted/replaced entries for relevant nodes within patches" $
\ patch -> let patch' = (unListableF <$> patch :: Patch (Term (Syntax ()) Int)) in tableOfContentsBy (Just . headF) (pure patch') `shouldBe` Patched <$> traverse (pure . lastValue) patch' \ patch -> let patch' = (unListableF <$> patch :: Patch (Term (Syntax ()) Int)) in tableOfContentsBy (Just . headF) (pure patch') `shouldBe` these (pure . Deleted) (pure . Inserted) ((<>) `on` pure . Replaced) (unPatch (lastValue <$> patch'))
prop "produces changed entries for relevant nodes containing irrelevant patches" $ prop "produces changed entries for relevant nodes containing irrelevant patches" $
\ diff -> let diff' = fmap (1 <$) <$> mapAnnotations (const (0 :: Int)) (wrap (pure 0 :< Indexed [unListableDiff diff :: Diff (Syntax ()) Int])) in \ diff -> let diff' = fmap (1 <$) <$> mapAnnotations (const (0 :: Int)) (wrap (pure 0 :< Indexed [unListableDiff diff :: Diff (Syntax ()) Int])) in