diff options
Diffstat (limited to 'test/test-pandoc.hs')
-rw-r--r-- | test/test-pandoc.hs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/test/test-pandoc.hs b/test/test-pandoc.hs index bb4db90b9..9973dffc8 100644 --- a/test/test-pandoc.hs +++ b/test/test-pandoc.hs @@ -4,6 +4,12 @@ module Main where import Prelude +import System.Environment (getArgs) +import qualified Control.Exception as E +import Text.Pandoc.App (convertWithOpts, defaultOpts, options, + parseOptionsFromArgs) +import Text.Pandoc.Error (handleError) +import System.Environment.Executable (getExecutablePath) import GHC.IO.Encoding import Test.Tasty import qualified Tests.Command @@ -46,12 +52,11 @@ import qualified Tests.Writers.Powerpoint import qualified Tests.Writers.RST import qualified Tests.Writers.AnnotatedTable import qualified Tests.Writers.TEI -import Tests.Helpers (findPandoc) import Text.Pandoc.Shared (inDirectory) tests :: FilePath -> TestTree tests pandocPath = testGroup "pandoc tests" - [ Tests.Command.tests pandocPath + [ Tests.Command.tests , testGroup "Old" (Tests.Old.tests pandocPath) , testGroup "Shared" Tests.Shared.tests , testGroup "Writers" @@ -102,7 +107,15 @@ tests pandocPath = testGroup "pandoc tests" main :: IO () main = do setLocaleEncoding utf8 - inDirectory "test" $ do - fp <- findPandoc - putStrLn $ "Using pandoc executable at " ++ fp - defaultMain $ tests fp + args <- getArgs + case args of + "--emulate":args' -> -- emulate pandoc executable + E.catch + (parseOptionsFromArgs options defaultOpts "pandoc" args' >>= + convertWithOpts) + (handleError . Left) + _ -> inDirectory "test" $ do + fp <- getExecutablePath + -- putStrLn $ "Using pandoc executable at " ++ fp + defaultMain $ tests fp + |