aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Command.hs
AgeCommit message (Collapse)AuthorFilesLines
2021-09-21Command tests: raise error if command doesn't begin with `%`.John MacFarlane1-5/+7
2021-08-10Add RTF reader.John MacFarlane1-2/+2
- `rtf` is now supported as an input format as well as output. - New module Text.Pandoc.Readers.RTF (exporting `readRTF`). [API change] Closes #3982.
2021-05-26Command tests: fail if a file contains no tests.John MacFarlane1-1/+4
And fix a test that failed in that way!
2021-03-19Tests: Use getExecutablePath from base...John MacFarlane1-1/+1
avoiding the need to depend on the executable-path package.
2021-03-19Tests: factor out setupEnvironment in Test.Helpers.John MacFarlane1-13/+2
This avoids code duplication between Command and Old.
2021-03-19Fix finding of data files from test programs.John MacFarlane1-1/+2
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.
2021-02-22Text.Pandoc.UTF8: change IO functions to return Text, not String.John MacFarlane1-1/+1
[API change] This affects `readFile`, `getContents`, `writeFileWith`, `writeFile`, `putStrWith`, `putStr`, `putStrLnWith`, `putStrLn`. `hPutStrWith`, `hPutStr`, `hPutStrLnWith`, `hPutStrLn`, `hGetContents`. This avoids the need to uselessly create a linked list of characters when emiting output.
2021-02-07Avoid unnecessary use of NoImplicitPrelude pragma (#7089)Albert Krewinkel1-2/+0
2021-02-02Fixed some compiler warnings in tests.John MacFarlane1-3/+2
2021-02-02Test suite: a more robust way of testing the executable.John MacFarlane1-28/+33
Mmny of our tests require running the pandoc executable. This is problematic for a few different reasons. First, cabal-install will sometimes run the test suite after building the library but before building the executable, which means the executable isn't in place for the tests. One can work around that by first building, then building and running the tests, but that's fragile. Second, we have to find the executable. So far, we've done that using a function findPandoc that attempts to locate it relative to the test executable (which can be located using findExecutablePath). But the logic here is delicate and work with every combination of options. To solve both problems, we add an `--emulate` option to the `test-pandoc` executable. When `--emulate` occurs as the first argument passed to `test-pandoc`, the program simply emulates the regular pandoc executable, using the rest of the arguments (after `--emulate`). Thus, test-pandoc --emulate -f markdown -t latex is just like pandoc -f markdown -t latex Since all the work is done by library functions, implementing this emulation just takes a couple lines of code and should be entirely reliable. With this change, we can test the pandoc executable by running the test program itself (locatable using findExecutablePath) with the `--emulate` option. This removes the need for the fragile `findPandoc` step, and it means we can run our integration tests even when we're just building the library, not the executable. Part of this change involved simplifying some complex handling to set environment variables for dynamic library paths. I have tested a build with `--enable-dynamic-executable`, and it works, but further testing may be needed.
2021-01-08Update copyright notices for 2021 (#7012)Albert Krewinkel1-1/+1
2020-10-07Use golden test framework for command tests.John MacFarlane1-27/+59
This means that `--accept` can be used to update expected output.
2020-05-18Propagate (DY)LD_LIBRARY_PATH in tests (#6376)Lila1-5/+7
2020-03-13Update copyright year (#6186)Albert Krewinkel1-1/+1
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-02-07Apply linter suggestions. Add fix_spacing to lint target in Makefile.John MacFarlane1-1/+0
2020-02-07Various minor cleanups and refactoring (#6117)Joseph C. Sible1-3/+3
* Use concatMap instead of reimplementing it * Replace an unnecessary multi-way if with a regular if * Use sortOn instead of sortBy and comparing * Use guards instead of lots of indents for if and else * Remove redundant do blocks * Extract common functions from both branches of maybe Whenever both the Nothing and the Just branch of maybe do the same function, do that function on the result of maybe instead. * Use fmap instead of reimplementing it from maybe * Use negative forms instead of negating the positive forms * Use mapMaybe instead of mapping and then using catMaybes * Use zipWith instead of mapping over the result of zip * Use unwords instead of reimplementing it * Use <$ instead of <$> and const * Replace case of Bool with if and else * Use find instead of listToMaybe and filter * Use zipWithM instead of mapM and zip * Inline lambda wrappers into the real functions * We get zipWithM from Text.Pandoc.Writers.Shared * Use maybe instead of fromMaybe and fmap I'm not sure how this one slipped past me. * Increase a bit of indentation
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-1/+2
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-0/+11
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2019-01-31Tests: avoid calling findPandoc multiple times.John MacFarlane1-4/+3
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-01-19hlint code improvements.John MacFarlane1-3/+3
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-3/+3
2017-08-14Test fixes so we can find data files.John MacFarlane1-3/+2
In old tests & command tests, we now set the environment variable pandoc_datadir. In lua tests, we set the datadir explicitly.
2017-08-13Fixed command tests to set local path.John MacFarlane1-5/+5
Previously we just tacked on a directory to the command line, but that didn't work when we e.g. used a pipe for round tripping, with two invocations of pandoc.
2017-08-11Command tests; print stderr when a test fails.John MacFarlane1-1/+4
2017-06-11Revert "Command tests: small change to try to fix appveyor failures."John MacFarlane1-4/+3
This reverts commit 0ab26ac9ebb0196691ec064820eac4e640f0d52c. Failed experiment.
2017-06-11Command tests: small change to try to fix appveyor failures.John MacFarlane1-3/+4
2017-06-10Changed all readers to take Text instead of String.John MacFarlane1-1/+2
Readers: Renamed StringReader -> TextReader. Updated tests. API change.
2017-05-25Test.Command: put stderr output at front, so it can be tested.John MacFarlane1-3/+3
2017-03-14Command tests: just findPandoc once.John MacFarlane1-4/+4
2017-03-14Small test plumbing improvement.John MacFarlane1-11/+11
2017-03-14Use tasty for tests rather than test-framework.John MacFarlane1-9/+9
2017-03-04Stylish-haskell automatic formatting changes.John MacFarlane1-16/+15
2017-02-04Consolidated some common functions in Tests.Helper.John MacFarlane1-39/+1
2017-02-04Added new test framework Tests.Command.John MacFarlane1-17/+57
Any files added under test/command will be treated as shell tests (see smart.md for an example). This makes it very easy to add regression tests etc.
2017-02-04Added skeleton for Tests.Command.John MacFarlane1-0/+91