Unit tests: On failure, print the input string.
This commit is contained in:
parent
608d5bc753
commit
831889bebc
2 changed files with 7 additions and 7 deletions
|
@ -11,7 +11,7 @@ import Test.HUnit hiding (Test)
|
||||||
|
|
||||||
-- in Helpers
|
-- in Helpers
|
||||||
class Expect a where
|
class Expect a where
|
||||||
(=?>) :: Pandoc -> a -> Assertion
|
(=?>) :: (String, Pandoc) -> a -> Assertion
|
||||||
|
|
||||||
infix 8 =?>
|
infix 8 =?>
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ infix 8 =?>
|
||||||
infix 6 =:
|
infix 6 =:
|
||||||
|
|
||||||
instance Expect Inlines where
|
instance Expect Inlines where
|
||||||
(Pandoc _ [Para ils]) =?> e = assertEqual " " (toList e) ils
|
(s, Pandoc _ [Para ils]) =?> e = assertEqual s (toList e) ils
|
||||||
g =?> e = assertEqual " " (doc $ para e) g
|
(s, g) =?> e = assertEqual s (doc $ para e) g
|
||||||
|
|
||||||
instance Expect Blocks where
|
instance Expect Blocks where
|
||||||
(Pandoc _ bls) =?> e = assertEqual " " (toList e) bls
|
(s, Pandoc _ bls) =?> e = assertEqual s (toList e) bls
|
||||||
|
|
||||||
instance Expect Pandoc where
|
instance Expect Pandoc where
|
||||||
g =?> e = assertEqual " " e g
|
(s, g) =?> e = assertEqual s e g
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import Text.Pandoc.Builder
|
||||||
import Text.Pandoc
|
import Text.Pandoc
|
||||||
import Text.Pandoc.Shared (normalize)
|
import Text.Pandoc.Shared (normalize)
|
||||||
|
|
||||||
latex :: String -> Pandoc
|
latex :: String -> (String, Pandoc)
|
||||||
latex = normalize . readLaTeX defaultParserState{stateSmart = True}
|
latex s = (s, normalize . readLaTeX defaultParserState{stateSmart = True} $ s)
|
||||||
|
|
||||||
tests :: [Test]
|
tests :: [Test]
|
||||||
tests = [ testGroup "basic"
|
tests = [ testGroup "basic"
|
||||||
|
|
Loading…
Add table
Reference in a new issue