diff --git a/test/PandocSpec.hs b/test/PandocSpec.hs new file mode 100644 index 000000000..ba43aeda5 --- /dev/null +++ b/test/PandocSpec.hs @@ -0,0 +1,27 @@ +module PandocSpec where + +import TestImport + +import Utils.Print + +import qualified Data.Map.Lazy as Map + +import Text.Pandoc +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 + + 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)