mirror of
https://github.com/github/semantic.git
synced 2024-11-29 02:44:36 +03:00
Pull the selection of the last value into a helper.
This commit is contained in:
parent
f7bc08427a
commit
d1d5f6454c
@ -35,11 +35,12 @@ spec = parallel $ do
|
|||||||
|
|
||||||
let entryValue e = case e of { Unchanged a -> a; Changed a -> a ; Patched p -> afterOrBefore p }
|
let entryValue e = case e of { Unchanged a -> a; Changed a -> a ; Patched p -> afterOrBefore p }
|
||||||
let diffSize = cata (succ . sum) . fmap (termSize . afterOrBefore)
|
let diffSize = cata (succ . sum) . fmap (termSize . afterOrBefore)
|
||||||
|
let lastValue = fromJust . getLast . foldMap (Last . Just)
|
||||||
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" $
|
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')))]
|
\ term -> let term' = (unListableF term :: Term (Syntax ()) (Record '[Category])) in tableOfContentsBy (Just . headF) (diffTerms term' term') `shouldBe` [Unchanged (lastValue term')]
|
||||||
|
|
||||||
describe "diffTOC" $ do
|
describe "diffTOC" $ do
|
||||||
it "blank if there are no methods" $
|
it "blank if there are no methods" $
|
||||||
|
Loading…
Reference in New Issue
Block a user