refactor(pandoc): rewrite tests for pandoc applyMetas (2)
This commit is contained in:
parent
58cc35d118
commit
10e823b0c5
@ -15,10 +15,10 @@ import Text.Pandoc.Arbitrary ()
|
|||||||
|
|
||||||
-- Instance Arbitrary Meta is somewhat useless, as it always generates the same 3 keys.
|
-- Instance Arbitrary Meta is somewhat useless, as it always generates the same 3 keys.
|
||||||
newtype ArbitraryMeta = ArbitraryMeta { unArbitraryMeta :: Meta }
|
newtype ArbitraryMeta = ArbitraryMeta { unArbitraryMeta :: Meta }
|
||||||
deriving newtype (Eq, Ord, Semigroup, Monoid, Show, Read, Typable, Data, Generic)
|
deriving newtype (Eq, Ord, Semigroup, Monoid, Show, Read, Typeable)
|
||||||
|
|
||||||
newtype ArbitraryPandoc = ArbitraryPandoc { unArbitraryPandoc :: Pandoc }
|
newtype ArbitraryPandoc = ArbitraryPandoc { unArbitraryPandoc :: Pandoc }
|
||||||
deriving newtype (Eq, Ord, Show, Read, Typable, Data, Generic)
|
deriving newtype (Eq, Ord, Show, Read, Typeable)
|
||||||
|
|
||||||
instance Arbitrary ArbitraryMeta where
|
instance Arbitrary ArbitraryMeta where
|
||||||
arbitrary = do
|
arbitrary = do
|
||||||
@ -78,7 +78,7 @@ spec = do
|
|||||||
(abMetaOverwrite, apd) <- generate arbitrary
|
(abMetaOverwrite, apd) <- generate arbitrary
|
||||||
let
|
let
|
||||||
metaOverwrite = unArbitraryMeta abMetaOverwrite
|
metaOverwrite = unArbitraryMeta abMetaOverwrite
|
||||||
pd@(Pandoc metaOriginal _) = unArbitraryPandoc apd
|
pd = unArbitraryPandoc apd
|
||||||
(Pandoc newMeta _) = addMeta metaOverwrite pd
|
(Pandoc newMeta _) = addMeta metaOverwrite pd
|
||||||
(unMeta metaOverwrite `Map.isSubmapOf` unMeta newMeta) `shouldBe` True
|
(unMeta metaOverwrite `Map.isSubmapOf` unMeta newMeta) `shouldBe` True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user