git.iko.soy/typeable/pandoc
on master help sign in
Eliminated use of TH in test suite.
daeb52dJohn MacFarlane
pandoc.cabal+1−2
@@ -384,7 +384,6 @@ Test-Suite test-pandoc
384 test-framework-quickcheck2 >= 0.2.9 && < 0.4,
384 test-framework-quickcheck2 >= 0.2.9 && < 0.4,
385 QuickCheck >= 2.4 && < 2.6,
385 QuickCheck >= 2.4 && < 2.6,
386 HUnit >= 1.2 && < 1.3,
386 HUnit >= 1.2 && < 1.3,
387− template-haskell >= 2.4 && < 2.9,
388 containers >= 0.1 && < 0.6,
387 containers >= 0.1 && < 0.6,
389 ansi-terminal == 0.5.*
388 ansi-terminal == 0.5.*
390 Other-Modules: Tests.Old
389 Other-Modules: Tests.Old
@@ -411,7 +410,7 @@ Test-Suite test-pandoc
411 else
410 else
412 cpp-options: -D_LIT=$lit
411 cpp-options: -D_LIT=$lit
413 Default-Language: Haskell98
412 Default-Language: Haskell98
414− Default-Extensions: CPP, TemplateHaskell, QuasiQuotes
413+ Default-Extensions: CPP
415
414
416benchmark benchmark-pandoc
415benchmark benchmark-pandoc
417 Type: exitcode-stdio-1.0
416 Type: exitcode-stdio-1.0
tests/Tests/Helpers.hs+2−29
@@ -1,9 +1,7 @@
1−{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, TemplateHaskell #-}
1+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
2-- Utility functions for the test suite.
2-- Utility functions for the test suite.
3
3
4−module Tests.Helpers ( lit
4+module Tests.Helpers ( test
5− , file
6− , test
7 , (=?>)
5 , (=?>)
8 , property
6 , property
9 , ToString(..)
7 , ToString(..)
@@ -20,34 +18,9 @@ import Test.HUnit (assertBool)
20import Text.Pandoc.Shared (normalize, trimr)
18import Text.Pandoc.Shared (normalize, trimr)
21import Text.Pandoc.Options
19import Text.Pandoc.Options
22import Text.Pandoc.Writers.Native (writeNative)
20import Text.Pandoc.Writers.Native (writeNative)
23−import Language.Haskell.TH.Quote (QuasiQuoter(..))
24−import Language.Haskell.TH.Syntax (Q, runIO)
25import qualified Test.QuickCheck.Property as QP
21import qualified Test.QuickCheck.Property as QP
26import Data.Algorithm.Diff
22import Data.Algorithm.Diff
27
23
28−lit :: QuasiQuoter
29−lit = QuasiQuoter {
30− quoteExp = (\a -> let b = rnl a in [|b|]) . filter (/= '\r')
31− , quotePat = error "Unimplemented"
32− , quoteType = error "Unimplemented"
33− , quoteDec = error "Unimplemented"
34− }
35− where rnl ('\n':xs) = xs
36− rnl xs = xs
37−
38−file :: QuasiQuoter
39−file = quoteFile lit
40−
41−-- adapted from TH 2.5 code
42−quoteFile :: QuasiQuoter -> QuasiQuoter
43−quoteFile (QuasiQuoter { quoteExp = qe, quotePat = qp }) =
44− QuasiQuoter { quoteExp = get qe, quotePat = get qp,
45− quoteType = error "Unimplemented", quoteDec = error "Unimplemented" }
46− where
47− get :: (String -> Q a) -> String -> Q a
48− get old_quoter file_name = do { file_cts <- runIO (readFile file_name)
49− ; old_quoter file_cts }
50−
51test :: (ToString a, ToString b, ToString c)
24test :: (ToString a, ToString b, ToString c)
52 => (a -> b) -- ^ function to test
25 => (a -> b) -- ^ function to test
53 -> String -- ^ name of test case
26 -> String -- ^ name of test case
tests/Tests/Readers/Markdown.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
2module Tests.Readers.Markdown (tests) where
2module Tests.Readers.Markdown (tests) where
3
3
4import Text.Pandoc.Definition
4import Text.Pandoc.Definition
tests/Tests/Readers/RST.hs+18−19
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
2module Tests.Readers.RST (tests) where
2module Tests.Readers.RST (tests) where
3
3
4import Text.Pandoc.Definition
4import Text.Pandoc.Definition
@@ -20,24 +20,23 @@ tests :: [Test]
20tests = [ "line block with blank line" =:
20tests = [ "line block with blank line" =:
21 "| a\n|\n| b" =?> para (str "a") <>
21 "| a\n|\n| b" =?> para (str "a") <>
22 para (str "\160b")
22 para (str "\160b")
23− , "field list" =:
23+ , "field list" =: unlines
24− [_LIT|
25−:Hostname: media08
24+ [ ":Hostname: media08"
26−:IP address: 10.0.0.19
25+ , ":IP address: 10.0.0.19"
27−:Size: 3ru
26+ , ":Size: 3ru"
28−:Date: 2001-08-16
27+ , ":Date: 2001-08-16"
29−:Version: 1
28+ , ":Version: 1"
30−:Authors: - Me
29+ , ":Authors: - Me"
31− - Myself
30+ , " - Myself"
32− - I
31+ , " - I"
33−:Indentation: Since the field marker may be quite long, the second
32+ , ":Indentation: Since the field marker may be quite long, the second"
34− and subsequent lines of the field body do not have to line up
33+ , " and subsequent lines of the field body do not have to line up"
35− with the first line, but they must be indented relative to the
34+ , " with the first line, but they must be indented relative to the"
36− field name marker, and they must line up with each other.
35+ , " field name marker, and they must line up with each other."
37−:Parameter i: integer
36+ , ":Parameter i: integer"
38−:Final: item
37+ , ":Final: item"
39− on two lines
38+ , " on two lines" ]
40−|] =?> ( setAuthors ["Me","Myself","I"]
39+ =?> ( setAuthors ["Me","Myself","I"]
41 $ setDate "2001-08-16"
40 $ setDate "2001-08-16"
42 $ doc
41 $ doc
43 $ definitionList [ (str "Hostname", [para "media08"])
42 $ definitionList [ (str "Hostname", [para "media08"])
tests/Tests/Writers/ConTeXt.hs+18−18
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
2module Tests.Writers.ConTeXt (tests) where
2module Tests.Writers.ConTeXt (tests) where
3
3
4import Test.Framework
4import Test.Framework
@@ -48,23 +48,23 @@ tests = [ testGroup "inline code"
48 [ "nested" =:
48 [ "nested" =:
49 bulletList [
49 bulletList [
50 plain (text "top")
50 plain (text "top")
51− <> bulletList [
51+ <> bulletList [
52− plain (text "next")
52+ plain (text "next")
53− <> bulletList [plain (text "bot")]
53+ <> bulletList [plain (text "bot")]
54− ]
54+ ]
55− ] =?> [_LIT|
55+ ] =?> unlines
56−\startitemize[packed]
56+ [ "\\startitemize[packed]"
57−\item
57+ , "\\item"
58− top
58+ , " top"
59− \startitemize[packed]
59+ , " \\startitemize[packed]"
60− \item
60+ , " \\item"
61− next
61+ , " next"
62− \startitemize[packed]
62+ , " \\startitemize[packed]"
63− \item
63+ , " \\item"
64− bot
64+ , " bot"
65− \stopitemize
65+ , " \\stopitemize"
66− \stopitemize
66+ , " \\stopitemize"
67−\stopitemize|]
67+ , "\\stopitemize" ]
68 ]
68 ]
69 ]
69 ]
70
70
tests/Tests/Writers/HTML.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
2module Tests.Writers.HTML (tests) where
2module Tests.Writers.HTML (tests) where
3
3
4import Test.Framework
4import Test.Framework
tests/Tests/Writers/LaTeX.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
2module Tests.Writers.LaTeX (tests) where
2module Tests.Writers.LaTeX (tests) where
3
3
4import Test.Framework
4import Test.Framework
tests/Tests/Writers/Markdown.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
2module Tests.Writers.Markdown (tests) where
2module Tests.Writers.Markdown (tests) where
3
3
4import Test.Framework
4import Test.Framework