aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Helpers.hs
diff options
context:
space:
mode:
Diffstat (limited to 'test/Tests/Helpers.hs')
-rw-r--r--test/Tests/Helpers.hs16
1 files changed, 5 insertions, 11 deletions
diff --git a/test/Tests/Helpers.hs b/test/Tests/Helpers.hs
index 5e3afe0c7..80bb559b0 100644
--- a/test/Tests/Helpers.hs
+++ b/test/Tests/Helpers.hs
@@ -79,16 +79,11 @@ showDiff (l,r) (Both _ _ : ds) =
showDiff (l+1,r+1) ds
-- | Find pandoc executable relative to test-pandoc
--- First, try in same directory (e.g. if both in ~/.cabal/bin)
--- Second, try ../pandoc (e.g. if in dist/XXX/build/test-pandoc)
findPandoc :: IO FilePath
findPandoc = do
testExePath <- getExecutablePath
- curdir <- getCurrentDirectory
- let relTestExePathParts = splitDirectories $ makeRelative curdir $
- takeDirectory testExePath
- let pandocPath =
- (case reverse relTestExePathParts of
+ let pandocDir =
+ case reverse (splitDirectories (takeDirectory testExePath)) of
-- cabalv2 with --disable-optimization
"test-pandoc" : "build" : "noopt" : "test-pandoc" : "t" : ps
-> joinPath (reverse ps) </>
@@ -100,11 +95,10 @@ findPandoc = do
-- cabalv1
"test-pandoc" : "build" : ps
-> joinPath (reverse ps) </> "build" </> "pandoc"
- _ -> error $ "findPandoc: could not find pandoc executable")
+ _ -> error $ "findPandoc: could not find pandoc executable"
+ let pandocPath = pandocDir </> "pandoc"
#ifdef _WINDOWS
- </> "pandoc" <.> "exe"
-#else
- </> "pandoc"
+ <.> "exe"
#endif
found <- doesFileExist pandocPath
if found