git.iko.soy/typeable/pandoc
on master help sign in
Eliminated use of TH in test suite.
commitdaeb52d4e0f21b0e1ad8c3ce17ee9f18a6394f63 authorJohn MacFarlane <fiddlosopher@gmail.com> dateWed 23 Jan 2013, 08:47 (14 years ago) parent9c299d2
8 files changed+43−72
pandoc.cabal+1−2 tests/Tests/Helpers.hs+2−29 tests/Tests/Readers/Markdown.hs+1−1 tests/Tests/Readers/RST.hs+18−19 tests/Tests/Writers/ConTeXt.hs+18−18 tests/Tests/Writers/HTML.hs+1−1 tests/Tests/Writers/LaTeX.hs+1−1 tests/Tests/Writers/Markdown.hs+1−1
pandoc.cabal+1−2
@@ -384,7 +384,6 @@ Test-Suite test-pandoc
384384 test-framework-quickcheck2 >= 0.2.9 && < 0.4,
385385 QuickCheck >= 2.4 && < 2.6,
386386 HUnit >= 1.2 && < 1.3,
387− template-haskell >= 2.4 && < 2.9,
388387 containers >= 0.1 && < 0.6,
389388 ansi-terminal == 0.5.*
390389 Other-Modules: Tests.Old
@@ -411,7 +410,7 @@ Test-Suite test-pandoc
411410 else
412411 cpp-options: -D_LIT=$lit
413412 Default-Language: Haskell98
414− Default-Extensions: CPP, TemplateHaskell, QuasiQuotes
413+ Default-Extensions: CPP
415414
416415benchmark benchmark-pandoc
417416 Type: exitcode-stdio-1.0
tests/Tests/Helpers.hs+2−29
@@ -1,9 +1,7 @@
1−{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, TemplateHaskell #-}
1+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
22-- Utility functions for the test suite.
33
4−module Tests.Helpers ( lit
5− , file
6− , test
4+module Tests.Helpers ( test
75 , (=?>)
86 , property
97 , ToString(..)
@@ -20,34 +18,9 @@ import Test.HUnit (assertBool)
2018import Text.Pandoc.Shared (normalize, trimr)
2119import Text.Pandoc.Options
2220import Text.Pandoc.Writers.Native (writeNative)
23−import Language.Haskell.TH.Quote (QuasiQuoter(..))
24−import Language.Haskell.TH.Syntax (Q, runIO)
2521import qualified Test.QuickCheck.Property as QP
2622import Data.Algorithm.Diff
2723
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−
5124test :: (ToString a, ToString b, ToString c)
5225 => (a -> b) -- ^ function to test
5326 -> String -- ^ name of test case
tests/Tests/Readers/Markdown.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
22module Tests.Readers.Markdown (tests) where
33
44import Text.Pandoc.Definition
tests/Tests/Readers/RST.hs+18−19
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
22module Tests.Readers.RST (tests) where
33
44import Text.Pandoc.Definition
@@ -20,24 +20,23 @@ tests :: [Test]
2020tests = [ "line block with blank line" =:
2121 "| a\n|\n| b" =?> para (str "a") <>
2222 para (str "\160b")
23− , "field list" =:
24− [_LIT|
25−:Hostname: media08
26−:IP address: 10.0.0.19
27−:Size: 3ru
28−:Date: 2001-08-16
29−:Version: 1
30−:Authors: - Me
31− - Myself
32− - I
33−: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
35− with the first line, but they must be indented relative to the
36− field name marker, and they must line up with each other.
37−:Parameter i: integer
38−:Final: item
39− on two lines
40−|] =?> ( setAuthors ["Me","Myself","I"]
23+ , "field list" =: unlines
24+ [ ":Hostname: media08"
25+ , ":IP address: 10.0.0.19"
26+ , ":Size: 3ru"
27+ , ":Date: 2001-08-16"
28+ , ":Version: 1"
29+ , ":Authors: - Me"
30+ , " - Myself"
31+ , " - I"
32+ , ":Indentation: Since the field marker may be quite long, the second"
33+ , " and subsequent lines of the field body do not have to line up"
34+ , " with the first line, but they must be indented relative to the"
35+ , " field name marker, and they must line up with each other."
36+ , ":Parameter i: integer"
37+ , ":Final: item"
38+ , " on two lines" ]
39+ =?> ( setAuthors ["Me","Myself","I"]
4140 $ setDate "2001-08-16"
4241 $ doc
4342 $ definitionList [ (str "Hostname", [para "media08"])
tests/Tests/Writers/ConTeXt.hs+18−18
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
22module Tests.Writers.ConTeXt (tests) where
33
44import Test.Framework
@@ -48,23 +48,23 @@ tests = [ testGroup "inline code"
4848 [ "nested" =:
4949 bulletList [
5050 plain (text "top")
51− <> bulletList [
52− plain (text "next")
53− <> bulletList [plain (text "bot")]
54− ]
55− ] =?> [_LIT|
56−\startitemize[packed]
57−\item
58− top
59− \startitemize[packed]
60− \item
61− next
62− \startitemize[packed]
63− \item
64− bot
65− \stopitemize
66− \stopitemize
67−\stopitemize|]
51+ <> bulletList [
52+ plain (text "next")
53+ <> bulletList [plain (text "bot")]
54+ ]
55+ ] =?> unlines
56+ [ "\\startitemize[packed]"
57+ , "\\item"
58+ , " top"
59+ , " \\startitemize[packed]"
60+ , " \\item"
61+ , " next"
62+ , " \\startitemize[packed]"
63+ , " \\item"
64+ , " bot"
65+ , " \\stopitemize"
66+ , " \\stopitemize"
67+ , "\\stopitemize" ]
6868 ]
6969 ]
7070
tests/Tests/Writers/HTML.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
22module Tests.Writers.HTML (tests) where
33
44import Test.Framework
tests/Tests/Writers/LaTeX.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
22module Tests.Writers.LaTeX (tests) where
33
44import Test.Framework
tests/Tests/Writers/Markdown.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
1+{-# LANGUAGE OverloadedStrings #-}
22module Tests.Writers.Markdown (tests) where
33
44import Test.Framework