summaryrefslogtreecommitdiff
path: root/tests/RunTests.hs
diff options
context:
space:
mode:
authorNathan Gass <gass@search.ch>2010-12-14 09:54:13 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2010-12-14 18:38:40 -0800
commit34d30efc5c58b8f60c44f5db369a3056780f654a (patch)
tree1949813ed8b83738df31adb77a1aaba399f3880e /tests/RunTests.hs
parent128cf46089f5a2fa688097f596563ecefd9c466b (diff)
Added citation tests.
Added tests for latex citation writer and reader, markdown citation writer and additional markup in citations.
Diffstat (limited to 'tests/RunTests.hs')
-rw-r--r--tests/RunTests.hs21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/RunTests.hs b/tests/RunTests.hs
index 0d8a1a6a1..0dc11ef0c 100644
--- a/tests/RunTests.hs
+++ b/tests/RunTests.hs
@@ -111,6 +111,11 @@ main = do
r11 <- runTest "native reader" ["-r", "native", "-w", "native", "-s"]
"testsuite.native" "testsuite.native"
r14s <- mapM (\style -> runTest ("markdown reader (citations) (" ++ style ++ ")") ["-r", "markdown", "-w", "markdown", "--bibliography", "biblio.bib", "--csl", style ++ ".csl", "--no-wrap"] "markdown-citations.txt" ("markdown-citations." ++ style ++ ".txt")) ["chicago-author-date","ieee","mhra"]
+ let citopts = ["--bibliography", "biblio.bib", "--csl", "chicago-author-date.csl", "--no-citeproc"]
+ r15 <- runTest "markdown writer (citations)" (["-r", "markdown", "-w", "markdown"] ++ citopts)
+ "markdown-citations.txt" "markdown-citations.txt"
+ r16s <- runLatexCitationTests citopts "biblatex"
+ r17s <- runLatexCitationTests citopts "natbib"
r12s <- if runLhsTests
then mapM runLhsWriterTest lhsWriterFormats
else putStrLn "Skipping lhs writer tests because they presuppose highlighting support" >> return []
@@ -126,7 +131,8 @@ main = do
, r10 -- latex
, rTextile1 -- textile
, r11 -- native
- ] ++ r12s ++ r13s ++ r14s
+ , r15 -- markdown citations
+ ] ++ r12s ++ r13s ++ r14s ++ r16s ++ r17s
if all id results
then do
putStrLn "\nAll tests passed."
@@ -149,6 +155,19 @@ runLhsReaderTest :: String -> IO Bool
runLhsReaderTest format =
runTest ("(lhs) " ++ format ++ " reader") ["-r", format, "-w", "html+lhs"] ("lhs-test" <.> format) "lhs-test.fragment.html+lhs"
+
+runLatexCitationTests :: [String] -> String -> IO [Bool]
+runLatexCitationTests o n
+ = sequence [ rt ("latex reader (" ++ n ++ " citations)") (["-r", "latex", "-w", "markdown", "-s"] ++ o')
+ f "markdown-citations.txt"
+ , rt ("latex writer (" ++ n ++ " citations)") (["-r", "markdown", "-w", "latex", "-s"] ++ o')
+ "markdown-citations.txt" f
+ ]
+ where
+ o' = o ++ ["--" ++ n]
+ f = n ++ "-citations.latex"
+ rt = runTest
+
runWriterTest :: String -> IO Bool
runWriterTest format = do
r1 <- runTest (format ++ " writer") ["-r", "native", "-s", "-w", format] "testsuite.native" ("writer" <.> format)