2011-01-18 23:34:34 -08:00
|
|
|
{-# LANGUAGE TypeSynonymInstances #-}
|
2011-01-13 11:11:55 -08:00
|
|
|
-- Utility functions for the test suite.
|
|
|
|
|
2011-01-13 10:59:44 -08:00
|
|
|
module Tests.Helpers where
|
2011-01-12 14:16:35 +01:00
|
|
|
|
|
|
|
import Text.Pandoc
|
2011-01-18 23:34:34 -08:00
|
|
|
import Text.Pandoc.Builder
|
2011-01-12 14:16:35 +01:00
|
|
|
import Test.Framework
|
|
|
|
import Test.Framework.Providers.HUnit
|
|
|
|
import Test.HUnit hiding (Test)
|
|
|
|
|
2011-01-18 23:34:34 -08:00
|
|
|
-- 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
|
2011-01-12 14:16:35 +01:00
|
|
|
|