diff options
| author | John MacFarlane <[email protected]> | 2012-10-20 23:12:01 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2012-10-20 23:12:14 -0700 |
| commit | f21a4bce5fb00aeeba2d8c2e5cf7f2d8a55de9cf (patch) | |
| tree | b20d5059f933a2f4eb4311b2e89126825f754031 | |
| parent | 5ed6863bd58a7c5e391c108bcf8e507c84c35835 (diff) | |
Moved tests to cabal test suite.
Tests are now built with 'cabal configure --enable-tests' and
run with 'cabal test'. There is no longer a tests flag.
| -rw-r--r-- | Setup.hs | 16 | ||||
| -rw-r--r-- | man/make-pandoc-man-pages.hs | 5 | ||||
| -rw-r--r-- | pandoc.cabal | 95 | ||||
| -rw-r--r-- | tests/Tests/Arbitrary.hs (renamed from src/Tests/Arbitrary.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Helpers.hs (renamed from src/Tests/Helpers.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Old.hs (renamed from src/Tests/Old.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Readers/LaTeX.hs (renamed from src/Tests/Readers/LaTeX.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Readers/Markdown.hs (renamed from src/Tests/Readers/Markdown.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Readers/RST.hs (renamed from src/Tests/Readers/RST.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Shared.hs (renamed from src/Tests/Shared.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Writers/ConTeXt.hs (renamed from src/Tests/Writers/ConTeXt.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Writers/HTML.hs (renamed from src/Tests/Writers/HTML.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Writers/LaTeX.hs (renamed from src/Tests/Writers/LaTeX.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Writers/Markdown.hs (renamed from src/Tests/Writers/Markdown.hs) | 0 | ||||
| -rw-r--r-- | tests/Tests/Writers/Native.hs (renamed from src/Tests/Writers/Native.hs) | 0 | ||||
| -rw-r--r-- | tests/test-pandoc.hs (renamed from src/test-pandoc.hs) | 3 |
16 files changed, 36 insertions, 83 deletions
@@ -16,9 +16,7 @@ import System.Exit main :: IO () main = do defaultMainWithHooks $ simpleUserHooks { - runTests = runTestSuite - , postBuild = makeManPages - , postCopy = \ _ flags pkg lbi -> + postCopy = \ _ flags pkg lbi -> installManpages pkg lbi (fromFlag $ copyVerbosity flags) (fromFlag $ copyDest flags) , postInst = \ _ flags pkg lbi -> @@ -32,18 +30,6 @@ main = do } exitWith ExitSuccess --- | Run test suite. -runTestSuite :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO a -runTestSuite args _ pkg lbi = do - let testDir = buildDir lbi </> "test-pandoc" - testDir' <- canonicalizePath testDir - let testArgs = "--timeout=5" : concatMap (\arg -> ["-t",arg]) args - if any id [buildable (buildInfo exe) | exe <- executables pkg, exeName exe == "test-pandoc"] - then inDirectory "tests" $ rawSystem (testDir' </> "test-pandoc") testArgs >>= exitWith - else do - putStrLn "Build pandoc with the 'tests' flag to run tests" - exitWith $ ExitFailure 3 - -- | Build man pages from markdown sources in man/ makeManPages :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO () makeManPages _ flags _ _ = do diff --git a/man/make-pandoc-man-pages.hs b/man/make-pandoc-man-pages.hs index 31a935a28..cfefa7aa3 100644 --- a/man/make-pandoc-man-pages.hs +++ b/man/make-pandoc-man-pages.hs @@ -23,7 +23,7 @@ main = do unless (null ds1 && null ds2) $ do rmContents <- UTF8.readFile "README" - let (Pandoc meta blocks) = readMarkdown def rmContents + let (Pandoc meta blocks) = readMarkdown defaultParserState rmContents let manBlocks = removeSect [Str "Wrappers"] $ removeSect [Str "Pandoc's",Space,Str "markdown"] blocks let syntaxBlocks = extractSect [Str "Pandoc's",Space,Str "markdown"] blocks @@ -43,7 +43,8 @@ makeManPage verbose page meta blocks = do writeManPage :: FilePath -> String -> Pandoc -> IO () writeManPage page templ doc = do - let opts = def{ writerStandalone = True + let opts = defaultWriterOptions{ + writerStandalone = True , writerTemplate = templ } let manPage = writeMan opts $ bottomUp (concatMap removeLinks) $ diff --git a/pandoc.cabal b/pandoc.cabal index 9487ce9d6..5240c268c 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -286,9 +286,9 @@ Library Text.Pandoc.PDF, Text.Pandoc.Templates, Text.Pandoc.Biblio, + Text.Pandoc.UTF8, Text.Pandoc.SelfContained Other-Modules: Text.Pandoc.XML, - Text.Pandoc.UTF8, Text.Pandoc.MIME, Text.Pandoc.UUID, Text.Pandoc.ImageSize, @@ -383,41 +383,6 @@ Test-Suite test-pandoc Type: exitcode-stdio-1.0 Main-Is: test-pandoc.hs Hs-Source-Dirs: tests - Build-Depends: base >= 4.2 && < 5, - syb >= 0.1 && < 0.4, - pandoc, - pandoc-types >= 1.10 && < 1.11, - bytestring >= 0.9 && < 1.0, - text >= 0.11 && < 0.12, - directory >= 1 && < 1.3, - filepath >= 1.1 && < 1.4, - process >= 1 && < 1.2, - directory >= 1 && < 1.3, - bytestring >= 0.9 && < 1.0, - zip-archive >= 0.1.1.7 && < 0.2, - utf8-string >= 0.3 && < 0.4, - old-locale >= 1 && < 1.1, - time >= 1.2 && < 1.5, - HTTP >= 4000.0.5 && < 4000.3, - texmath >= 0.6.0.2 && < 0.7, - xml >= 1.3.12 && < 1.4, - random >= 1 && < 1.1, - extensible-exceptions >= 0.1 && < 0.2, - citeproc-hs >= 0.3.4 && < 0.4, - pandoc-types >= 1.9.0.2 && < 1.10, - json >= 0.4 && < 0.6, - tagsoup >= 0.12.5 && < 0.13, - base64-bytestring >= 0.1 && < 0.2, - zlib >= 0.5 && < 0.6, - highlighting-kate >= 0.5.1 && < 0.6, - temporary >= 1.1 && < 1.2 - if flag(blaze_html_0_5) - build-depends: - blaze-html >= 0.5 && < 0.6, - blaze-markup >= 0.5.1 && < 0.6 - else - build-depends: - blaze-html >= 0.4.3.0 && < 0.5 if impl(ghc >= 6.10) Build-depends: base >= 4 && < 5, syb >= 0.1 && < 0.4 else @@ -439,33 +404,33 @@ Test-Suite test-pandoc ScopedTypeVariables, GeneralizedNewtypeDeriving, RelaxedPolyRec, DeriveDataTypeable, TypeSynonymInstances, FlexibleInstances - Hs-Source-Dirs: src - -- END DUPLICATED SECTION - if !flag(tests) - Buildable: False + if impl(ghc >= 7) + cpp-options: -D_LIT=lit else - Buildable: True - if impl(ghc >= 7) - cpp-options: -D_LIT=lit - else - cpp-options: -D_LIT=$lit - Other-Extensions: TemplateHaskell, QuasiQuotes - Build-Depends: Diff, test-framework >= 0.3 && < 0.7, - test-framework-hunit >= 0.2 && < 0.3, - test-framework-quickcheck2 >= 0.2.9 && < 0.3, - QuickCheck >= 2.4 && < 2.6, - HUnit >= 1.2 && < 1.3, - template-haskell >= 2.4 && < 2.8, - ansi-terminal == 0.5.* - Other-Modules: Tests.Old - Tests.Helpers - Tests.Arbitrary - Tests.Shared - Tests.Readers.LaTeX - Tests.Readers.Markdown - Tests.Readers.RST - Tests.Writers.Native - Tests.Writers.ConTeXt - Tests.Writers.HTML - Tests.Writers.Markdown - Tests.Writers.LaTeX + cpp-options: -D_LIT=$lit + Other-Extensions: TemplateHaskell, QuasiQuotes + Build-Depends: pandoc, Diff, test-framework >= 0.3 && < 0.7, + pandoc-types >= 1.9.0.2 && < 1.10, + test-framework-hunit >= 0.2 && < 0.3, + test-framework-quickcheck2 >= 0.2.9 && < 0.3, + process >= 1 && < 1.2, + filepath >= 1.1 && < 1.4, + directory >= 1 && < 1.3, + bytestring >= 0.9 && < 1.0, + utf8-string >= 0.3 && < 0.4, + QuickCheck >= 2.4 && < 2.6, + HUnit >= 1.2 && < 1.3, + template-haskell >= 2.4 && < 2.8, + ansi-terminal == 0.5.* + Other-Modules: Tests.Old + Tests.Helpers + Tests.Arbitrary + Tests.Shared + Tests.Readers.LaTeX + Tests.Readers.Markdown + Tests.Readers.RST + Tests.Writers.Native + Tests.Writers.ConTeXt + Tests.Writers.HTML + Tests.Writers.Markdown + Tests.Writers.LaTeX diff --git a/src/Tests/Arbitrary.hs b/tests/Tests/Arbitrary.hs index 9d65e1f1f..9d65e1f1f 100644 --- a/src/Tests/Arbitrary.hs +++ b/tests/Tests/Arbitrary.hs diff --git a/src/Tests/Helpers.hs b/tests/Tests/Helpers.hs index 66879efed..66879efed 100644 --- a/src/Tests/Helpers.hs +++ b/tests/Tests/Helpers.hs diff --git a/src/Tests/Old.hs b/tests/Tests/Old.hs index 67eb51573..67eb51573 100644 --- a/src/Tests/Old.hs +++ b/tests/Tests/Old.hs diff --git a/src/Tests/Readers/LaTeX.hs b/tests/Tests/Readers/LaTeX.hs index d60026b20..d60026b20 100644 --- a/src/Tests/Readers/LaTeX.hs +++ b/tests/Tests/Readers/LaTeX.hs diff --git a/src/Tests/Readers/Markdown.hs b/tests/Tests/Readers/Markdown.hs index 5ad974adf..5ad974adf 100644 --- a/src/Tests/Readers/Markdown.hs +++ b/tests/Tests/Readers/Markdown.hs diff --git a/src/Tests/Readers/RST.hs b/tests/Tests/Readers/RST.hs index 3269092a6..3269092a6 100644 --- a/src/Tests/Readers/RST.hs +++ b/tests/Tests/Readers/RST.hs diff --git a/src/Tests/Shared.hs b/tests/Tests/Shared.hs index f4bf13da4..f4bf13da4 100644 --- a/src/Tests/Shared.hs +++ b/tests/Tests/Shared.hs diff --git a/src/Tests/Writers/ConTeXt.hs b/tests/Tests/Writers/ConTeXt.hs index beb6411f0..beb6411f0 100644 --- a/src/Tests/Writers/ConTeXt.hs +++ b/tests/Tests/Writers/ConTeXt.hs diff --git a/src/Tests/Writers/HTML.hs b/tests/Tests/Writers/HTML.hs index 8561aa421..8561aa421 100644 --- a/src/Tests/Writers/HTML.hs +++ b/tests/Tests/Writers/HTML.hs diff --git a/src/Tests/Writers/LaTeX.hs b/tests/Tests/Writers/LaTeX.hs index 7987716f3..7987716f3 100644 --- a/src/Tests/Writers/LaTeX.hs +++ b/tests/Tests/Writers/LaTeX.hs diff --git a/src/Tests/Writers/Markdown.hs b/tests/Tests/Writers/Markdown.hs index d90dc83b1..d90dc83b1 100644 --- a/src/Tests/Writers/Markdown.hs +++ b/tests/Tests/Writers/Markdown.hs diff --git a/src/Tests/Writers/Native.hs b/tests/Tests/Writers/Native.hs index 19740e0f4..19740e0f4 100644 --- a/src/Tests/Writers/Native.hs +++ b/tests/Tests/Writers/Native.hs diff --git a/src/test-pandoc.hs b/tests/test-pandoc.hs index 1a8c05e14..968f31df6 100644 --- a/src/test-pandoc.hs +++ b/tests/test-pandoc.hs @@ -14,6 +14,7 @@ import qualified Tests.Writers.HTML import qualified Tests.Writers.Native import qualified Tests.Writers.Markdown import qualified Tests.Shared +import Text.Pandoc.Shared (inDirectory) tests :: [Test] tests = [ testGroup "Old" Tests.Old.tests @@ -33,4 +34,4 @@ tests = [ testGroup "Old" Tests.Old.tests ] main :: IO () -main = defaultMain tests +main = inDirectory "tests" $ defaultMain tests |
