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.
This commit is contained in:
parent
422bba202e
commit
c5384a33c0
3 changed files with 13 additions and 7 deletions
10
pandoc.cabal
10
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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue