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 = 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 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