aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Command.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2021-03-19 18:54:49 -0700
committerJohn MacFarlane <[email protected]>2021-03-19 18:57:13 -0700
commit2ca1b20a85303dc8656f782f5804afdec215948b (patch)
tree820586530382fce5d331542de0f4c47231f5c954 /test/Tests/Command.hs
parentc3a9322b930c4b7e9bbf880d5df5e972efcaf0ff (diff)
Fix finding of data files from test programs.
Apparently Cabal sets a `pandoc_datadir` environment variable so that the data files will be sought in the source directory rather than in the final destination (where they aren't yet installed). So we no longer need to set `--data-dir` in the tests. We just need to make sure `pandoc_datadir` is set in the environment when we call the program in the test suite. This will fix the issue with loading of pandoc.lua when pandoc is built with `-embed_data_files`, reported in #7163. Closes #7163.
Diffstat (limited to 'test/Tests/Command.hs')
-rw-r--r--test/Tests/Command.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/Tests/Command.hs b/test/Tests/Command.hs
index 59b04eac1..dc0e25dbe 100644
--- a/test/Tests/Command.hs
+++ b/test/Tests/Command.hs
@@ -40,11 +40,12 @@ execTest :: String -- ^ Path to test executable
execTest testExePath cmd inp = do
mldpath <- Env.lookupEnv "LD_LIBRARY_PATH"
mdyldpath <- Env.lookupEnv "DYLD_LIBRARY_PATH"
+ mpdd <- Env.lookupEnv "pandoc_datadir"
let env' = ("PATH",takeDirectory testExePath) :
("TMP",".") :
("LANG","en_US.UTF-8") :
("HOME", "./") :
- ("pandoc_datadir", "..") :
+ maybe [] ((:[]) . ("pandoc_datadir",)) mpdd ++
maybe [] ((:[]) . ("LD_LIBRARY_PATH",)) mldpath ++
maybe [] ((:[]) . ("DYLD_LIBRARY_PATH",)) mdyldpath
let pr = (shell (pandocToEmulate True cmd)){ env = Just env' }