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.
This commit is contained in:
parent
c3a9322b93
commit
2ca1b20a85
2 changed files with 5 additions and 2 deletions
|
@ -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' }
|
||||
|
|
|
@ -321,9 +321,11 @@ testWithNormalize normalizer pandocPath testname opts inp norm =
|
|||
getActual = do
|
||||
mldpath <- Env.lookupEnv "LD_LIBRARY_PATH"
|
||||
mdyldpath <- Env.lookupEnv "DYLD_LIBRARY_PATH"
|
||||
mpdd <- Env.lookupEnv "pandoc_datadir"
|
||||
let env = ("TMP",".") :
|
||||
("LANG","en_US.UTF-8") :
|
||||
("HOME", "./") :
|
||||
maybe [] ((:[]) . ("pandoc_datadir",)) mpdd ++
|
||||
maybe [] ((:[]) . ("LD_LIBRARY_PATH",)) mldpath ++
|
||||
maybe [] ((:[]) . ("DYLD_LIBRARY_PATH",)) mdyldpath
|
||||
|
||||
|
@ -335,7 +337,7 @@ testWithNormalize normalizer pandocPath testname opts inp norm =
|
|||
-- filter \r so the tests will work on Windows machines
|
||||
else fail $ "Pandoc failed with error code " ++ show ec
|
||||
updateGolden = UTF8.writeFile norm . T.pack
|
||||
options = ["--data-dir=../data","--quiet"] ++ [inp] ++ opts
|
||||
options = ["--quiet"] ++ [inp] ++ opts
|
||||
|
||||
compareValues :: FilePath -> [String] -> String -> String -> IO (Maybe String)
|
||||
compareValues norm options expected actual = do
|
||||
|
|
Loading…
Reference in a new issue