aboutsummaryrefslogtreecommitdiff
path: root/test/Tests
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-14 23:39:28 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-14 23:39:28 +0100
commit93c49a28652abe12657b28b559c9780e48b49cc7 (patch)
tree17ed5aa0ab36df3f056de46c4b87c1f364f3e454 /test/Tests
parent14edbd2967810991b665e68611f23835ff8866f7 (diff)
downloadpandoc-93c49a28652abe12657b28b559c9780e48b49cc7.tar.gz
Command tests: just findPandoc once.
Diffstat (limited to 'test/Tests')
-rw-r--r--test/Tests/Command.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/Tests/Command.hs b/test/Tests/Command.hs
index b15d95fa7..054ceb50d 100644
--- a/test/Tests/Command.hs
+++ b/test/Tests/Command.hs
@@ -50,9 +50,10 @@ runTest testname cmd inp norm = testCase testname $ do
tests :: TestTree
tests = unsafePerformIO $ do
+ pandocpath <- findPandoc
files <- filter (".md" `isSuffixOf`) <$>
getDirectoryContents "command"
- let cmds = map extractCommandTest files
+ let cmds = map (extractCommandTest pandocpath) files
return $ testGroup "Command:" cmds
isCodeBlock :: Block -> Bool
@@ -80,9 +81,8 @@ runCommandTest pandocpath (num, code) =
shcmd = trimr $ takeDirectory pandocpath </> cmd
in runTest ("#" ++ show num) shcmd input norm
-extractCommandTest :: FilePath -> TestTree
-extractCommandTest fp = unsafePerformIO $ do
- pandocpath <- findPandoc
+extractCommandTest :: FilePath -> FilePath -> TestTree
+extractCommandTest pandocpath fp = unsafePerformIO $ do
contents <- UTF8.readFile ("command" </> fp)
Pandoc _ blocks <- runIOorExplode (readMarkdown
def{ readerExtensions = pandocExtensions } contents)