aboutsummaryrefslogtreecommitdiff
path: root/tests/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Tests')
-rw-r--r--tests/Tests/Old.hs18
-rw-r--r--tests/Tests/Readers/LaTeX.hs7
-rw-r--r--tests/Tests/Writers/LaTeX.hs7
3 files changed, 18 insertions, 14 deletions
diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs
index 8609781d0..01e4403fb 100644
--- a/tests/Tests/Old.hs
+++ b/tests/Tests/Old.hs
@@ -63,7 +63,10 @@ tests = [ testGroup "markdown"
"markdown-reader-more.txt" "markdown-reader-more.native"
, lhsReaderTest "markdown+lhs"
]
- , testGroup "citations" markdownCitationTests
+ , testGroup "citations"
+ [ test "citations" ["-r", "markdown", "-w", "native"]
+ "markdown-citations.txt" "markdown-citations.native"
+ ]
]
, testGroup "rst"
[ testGroup "writer" (writerTests "rst" ++ lhsWriterTests "rst")
@@ -190,19 +193,6 @@ fb2WriterTest title opts inputfile normfile =
ignoreBinary = unlines . filter (not . startsWith "<binary ") . lines
startsWith tag str = all (uncurry (==)) $ zip tag str
-markdownCitationTests :: [Test]
-markdownCitationTests
- = map styleToTest ["chicago-author-date","ieee","mhra"]
- ++ [test "natbib" wopts "markdown-citations.txt"
- "markdown-citations.txt"]
- where
- ropts = ["-r", "markdown", "-w", "markdown-citations", "--bibliography",
- "biblio.bib", "--no-wrap"]
- wopts = ["-r", "markdown", "-w", "markdown", "--no-wrap", "--natbib"]
- styleToTest style = test style (ropts ++ ["--csl", style ++ ".csl"])
- "markdown-citations.txt"
- ("markdown-citations." ++ style ++ ".txt")
-
-- | Run a test without normalize function, return True if test passed.
test :: String -- ^ Title of test
-> [String] -- ^ Options to pass to pandoc
diff --git a/tests/Tests/Readers/LaTeX.hs b/tests/Tests/Readers/LaTeX.hs
index 88029b7c2..dff6e4537 100644
--- a/tests/Tests/Readers/LaTeX.hs
+++ b/tests/Tests/Readers/LaTeX.hs
@@ -55,6 +55,13 @@ tests = [ testGroup "basic"
"hi % this is a comment\nthere\n" =?> para "hi there"
]
+ , testGroup "code blocks"
+ [ "identifier" =:
+ "\\begin{lstlisting}[label=test]\\end{lstlisting}" =?> codeBlockWith ("test", [], [("label","test")]) ""
+ , "no identifier" =:
+ "\\begin{lstlisting}\\end{lstlisting}" =?> codeBlock ""
+ ]
+
, testGroup "citations"
[ natbibCitations
, biblatexCitations
diff --git a/tests/Tests/Writers/LaTeX.hs b/tests/Tests/Writers/LaTeX.hs
index ebde5b97c..5f702a85d 100644
--- a/tests/Tests/Writers/LaTeX.hs
+++ b/tests/Tests/Writers/LaTeX.hs
@@ -10,6 +10,9 @@ import Tests.Arbitrary()
latex :: (ToString a, ToPandoc a) => a -> String
latex = writeLaTeX def . toPandoc
+latexListing :: (ToString a, ToPandoc a) => a -> String
+latexListing = writeLaTeX def{ writerListings = True } . toPandoc
+
{-
"my test" =: X =?> Y
@@ -31,6 +34,10 @@ tests :: [Test]
tests = [ testGroup "code blocks"
[ "in footnotes" =: note (para "hi" <> codeBlock "hi") =?>
"\\footnote{hi\n\n\\begin{Verbatim}\nhi\n\\end{Verbatim}\n}"
+ , test latexListing "identifier" $ codeBlockWith ("id",[],[]) "hi" =?>
+ ("\\begin{lstlisting}[label=id]\nhi\n\\end{lstlisting}" :: String)
+ , test latexListing "no identifier" $ codeBlock "hi" =?>
+ ("\\begin{lstlisting}\nhi\n\\end{lstlisting}" :: String)
]
, testGroup "math"
[ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>