test(pandoc): add more tests for pandoc helper functions

This commit is contained in:
Steffen Jost 2022-07-14 18:20:57 +02:00
parent 9fa12dc758
commit 8b14cd6c4c

View File

@ -11,7 +11,8 @@ import Text.Pandoc.Arbitrary
spec :: Spec spec :: Spec
spec = describe "addMeta" $ do spec = do
describe "addMeta" $ do
it "should overwrite existing settings" $ do it "should overwrite existing settings" $ do
metaOverwrite <- arbitrary metaOverwrite <- arbitrary
pd <- arbitrary pd <- arbitrary
@ -25,3 +26,13 @@ spec = describe "addMeta" $ do
(Pandoc keptMeta _) = pd (Pandoc keptMeta _) = pd
(Pandoc newMeta _) = addMeta metaOverwrite pd (Pandoc newMeta _) = addMeta metaOverwrite pd
Map.toList newMeta `shouldContain` Map.toList (keptMeta `Map.difference` metaOverwrite) 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