pandoc/tests/Tests/Helpers.hs
John MacFarlane 0502c0fd28 Revamped tests with new =: and =?> operators + builder.
Left in a couple failing tests for demonstration purposes.
2011-01-18 23:34:34 -08:00

32 lines
713 B
Haskell

{-# LANGUAGE TypeSynonymInstances #-}
-- Utility functions for the test suite.
module Tests.Helpers where
import Text.Pandoc
import Text.Pandoc.Builder
import Test.Framework
import Test.Framework.Providers.HUnit
import Test.HUnit hiding (Test)
-- in Helpers
class Expect a where
(=?>) :: Pandoc -> a -> Assertion
infix 8 =?>
(=:) :: TestName -> Assertion -> Test
(=:) = testCase
infix 6 =:
instance Expect Inlines where
(Pandoc _ [Para ils]) =?> e = assertEqual " " (toList e) ils
g =?> e = assertEqual " " (doc $ para e) g
instance Expect Blocks where
(Pandoc _ bls) =?> e = assertEqual " " (toList e) bls
instance Expect Pandoc where
g =?> e = assertEqual " " e g