summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-08-25 20:48:38 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2013-08-25 20:48:38 -0700
commite7a4bcc6fed37afbba423e4c41df6043d7158b3f (patch)
tree8c6e59c1dcb6749262e87ba701b1dce736ab1123 /tests
parenta68805bebd172b107e75fe330698cbc7eee7f75a (diff)
parent5f09cf7ff033ae11c5094fe39f8cd2ac11657229 (diff)
Merge pull request #961 from nougad/add_latex_listings_label
Write id for code block to label attr in latex when listing is used
Diffstat (limited to 'tests')
-rw-r--r--tests/Tests/Readers/LaTeX.hs7
-rw-r--r--tests/Tests/Writers/LaTeX.hs7
2 files changed, 14 insertions, 0 deletions
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\\}}") =?>