From 8b14cd6c4caed77a4acdf2fd39fcc7730c53484f Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Thu, 14 Jul 2022 18:20:57 +0200 Subject: [PATCH] test(pandoc): add more tests for pandoc helper functions --- test/PandocSpec.hs | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/test/PandocSpec.hs b/test/PandocSpec.hs index ba43aeda5..dcc3fbeac 100644 --- a/test/PandocSpec.hs +++ b/test/PandocSpec.hs @@ -11,17 +11,28 @@ import Text.Pandoc.Arbitrary spec :: Spec -spec = describe "addMeta" $ do - it "should overwrite existing settings" $ do - metaOverwrite <- arbitrary - pd <- arbitrary - let (Pandoc newMeta _) = addMeta metaOverwrite pd - Map.toList newMeta `shouldContain` Map.toList metaOverwrite +spec = do + describe "addMeta" $ do + it "should overwrite existing settings" $ do + metaOverwrite <- arbitrary + pd <- arbitrary + let (Pandoc newMeta _) = addMeta metaOverwrite pd + Map.toList newMeta `shouldContain` Map.toList metaOverwrite - it "should preserve untouched settings" $ do - metaOverwrite <- arbitrary - pd <- arbitrary - let - (Pandoc keptMeta _) = pd - (Pandoc newMeta _) = addMeta metaOverwrite pd - Map.toList newMeta `shouldContain` Map.toList (keptMeta `Map.difference` metaOverwrite) + it "should preserve untouched settings" $ do + metaOverwrite <- arbitrary + pd <- arbitrary + let + (Pandoc keptMeta _) = pd + (Pandoc newMeta _) = addMeta metaOverwrite pd + Map.toList newMeta `shouldContain` Map.toList (keptMeta `Map.difference` metaOverwrite) + + it "should preserve document block" $ do + metaOverwrite <- arbitrary + pd <- arbitrary + let + (Pandoc _ oldBlocks) = pd + (Pandoc - newBlocks) = addMeta metaOverwrite pd + oldBlocks `shouldBe` newBlocks + + describe "_Meta" . it "is a lens" . property $ isLens _Meta \ No newline at end of file