From d1d5f6454c145cac3bfb5d65faca12f3cdf62cf7 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 11 May 2017 13:07:18 -0400 Subject: [PATCH] Pull the selection of the last value into a helper. --- test/TOCSpec.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/TOCSpec.hs b/test/TOCSpec.hs index e57b49acc..99fd61697 100644 --- a/test/TOCSpec.hs +++ b/test/TOCSpec.hs @@ -35,11 +35,12 @@ spec = parallel $ do 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 lastValue = fromJust . getLast . foldMap (Last . Just) 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') () 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 it "blank if there are no methods" $