From c5384a33c0488d7e1274ba5579a24cf733eee934 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 26 Jan 2011 09:09:32 -0800 Subject: [PATCH] Updates for compiling with ghc 7. We now use a CPP trick to have compatible quasiquotes that work in both GHC 6.12 and 7. --- pandoc.cabal | 10 +++++++--- tests/Tests/Helpers.hs | 8 +++++--- tests/Tests/Writers/ConTeXt.hs | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pandoc.cabal b/pandoc.cabal index f57ca1bb2..c441a9439 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -330,7 +330,11 @@ Executable test-pandoc Hs-Source-Dirs: tests, src Main-Is: test-pandoc.hs if flag(highlighting) - cpp-options: -D_HIGHLIGHTING + cpp-options: -D_HIGHLIGHTING + if impl(ghc >= 7) + cpp-options: -D_LIT=lit + else + cpp-options: -D_LIT=$lit if !flag(tests) Buildable: False else @@ -342,9 +346,9 @@ Executable test-pandoc Build-Depends: base >= 4 && < 5, Diff, test-framework >= 0.3 && < 0.4, test-framework-hunit >= 0.2 && < 0.3, test-framework-quickcheck2 >= 0.2.9 && < 0.3, - QuickCheck == 2.4.*, + QuickCheck >= 2.4 && < 2.6, HUnit >= 1.2 && < 1.3, - template-haskell == 2.4.*, + template-haskell >= 2.4 && < 2.6, ansi-terminal == 0.5.* Other-Modules: Tests.Old Tests.Helpers diff --git a/tests/Tests/Helpers.hs b/tests/Tests/Helpers.hs index 53bad097e..b8d6b83a7 100644 --- a/tests/Tests/Helpers.hs +++ b/tests/Tests/Helpers.hs @@ -20,15 +20,17 @@ import Test.HUnit (assertBool) import Text.Pandoc.Shared (normalize, defaultWriterOptions, WriterOptions(..), removeTrailingSpace) import Text.Pandoc.Writers.Native (writeNative) -import Language.Haskell.TH.Quote +import Language.Haskell.TH.Quote (QuasiQuoter(..)) import Language.Haskell.TH.Syntax (Q, runIO) import qualified Test.QuickCheck.Property as QP import System.Console.ANSI import Data.Algorithm.Diff lit :: QuasiQuoter -lit = QuasiQuoter ((\a -> let b = rnl a in [|b|]) . filter (/= '\r')) $ - error "Cannot use lit as a pattern" +lit = QuasiQuoter { + quoteExp = (\a -> let b = rnl a in [|b|]) . filter (/= '\r') + , quotePat = error "Cannot use lit as a pattern" + } where rnl ('\n':xs) = xs rnl xs = xs diff --git a/tests/Tests/Writers/ConTeXt.hs b/tests/Tests/Writers/ConTeXt.hs index db01e1560..ab8efee3d 100644 --- a/tests/Tests/Writers/ConTeXt.hs +++ b/tests/Tests/Writers/ConTeXt.hs @@ -52,7 +52,7 @@ tests = [ testGroup "inline code" bulletList [plain (text "top") ,bulletList [plain (text "next") ,bulletList [plain (text "bot")]]] - =?> [$lit| + =?> [_LIT| \startitemize \item top