summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexander Batischev <eual.jp@gmail.com>2020-12-30 15:48:40 +0300
committerGitHub <noreply@github.com>2020-12-30 15:48:40 +0300
commit87e93c6c95b86b435b532286e07b0a9b896aef8f (patch)
tree7c25f12b9297c5c055ffc88c28c6267ff33450c7 /tests
parentef1bad68d6e9d62da7a1115a7d75bad689b62817 (diff)
downloadhakyll-87e93c6c95b86b435b532286e07b0a9b896aef8f.tar.gz
Fix golden test failing with pandoc >= 2.11.3 (#829)
The new version started wrapping Biblio references into <p> tags, so we now keep two different golden files for different Pandoc versions. I had to add Pandoc to dependencies of the test suite, otherwise GHC won't define `MIN_VERSION_pandoc` macro.
Diffstat (limited to 'tests')
-rw-r--r--tests/Hakyll/Web/Pandoc/Biblio/Tests.hs5
-rw-r--r--tests/data/biblio/biblio01-pre-pandoc-2.11.3.golden16
-rw-r--r--tests/data/biblio/biblio01.golden2
3 files changed, 22 insertions, 1 deletions
diff --git a/tests/Hakyll/Web/Pandoc/Biblio/Tests.hs b/tests/Hakyll/Web/Pandoc/Biblio/Tests.hs
index fb98f08..9135086 100644
--- a/tests/Hakyll/Web/Pandoc/Biblio/Tests.hs
+++ b/tests/Hakyll/Web/Pandoc/Biblio/Tests.hs
@@ -1,5 +1,6 @@
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE CPP #-}
module Hakyll.Web.Pandoc.Biblio.Tests
( tests
) where
@@ -36,7 +37,11 @@ goldenTest01 :: TestTree
goldenTest01 =
goldenVsString
"biblio01"
+#if MIN_VERSION_pandoc(2,11,3)
(goldenTestsDataDir </> "biblio01.golden")
+#else
+ (goldenTestsDataDir </> "biblio01-pre-pandoc-2.11.3.golden")
+#endif
(do
-- Code lifted from https://github.com/jaspervdj/hakyll-citeproc-example.
logger <- Logger.new Logger.Error
diff --git a/tests/data/biblio/biblio01-pre-pandoc-2.11.3.golden b/tests/data/biblio/biblio01-pre-pandoc-2.11.3.golden
new file mode 100644
index 0000000..ace1e76
--- /dev/null
+++ b/tests/data/biblio/biblio01-pre-pandoc-2.11.3.golden
@@ -0,0 +1,16 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>This page cites a paper.</title>
+ </head>
+ <body>
+ <h1>This page cites a paper.</h1>
+ <p>I would like to cite one of my favourite papers <span class="citation" data-cites="meijer1991functional">(Meijer, Fokkinga, and Paterson 1991)</span> here.</p>
+<div id="refs" class="references csl-bib-body hanging-indent" role="doc-bibliography">
+<div id="ref-meijer1991functional" class="csl-entry" role="doc-biblioentry">
+Meijer, Erik, Maarten Fokkinga, and Ross Paterson. 1991. <span>“Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire.”</span> In <em>Conference on Functional Programming Languages and Computer Architecture</em>, 124–44. Springer.
+</div>
+</div>
+ </body>
+</html>
diff --git a/tests/data/biblio/biblio01.golden b/tests/data/biblio/biblio01.golden
index ace1e76..9053456 100644
--- a/tests/data/biblio/biblio01.golden
+++ b/tests/data/biblio/biblio01.golden
@@ -9,7 +9,7 @@
<p>I would like to cite one of my favourite papers <span class="citation" data-cites="meijer1991functional">(Meijer, Fokkinga, and Paterson 1991)</span> here.</p>
<div id="refs" class="references csl-bib-body hanging-indent" role="doc-bibliography">
<div id="ref-meijer1991functional" class="csl-entry" role="doc-biblioentry">
-Meijer, Erik, Maarten Fokkinga, and Ross Paterson. 1991. <span>“Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire.”</span> In <em>Conference on Functional Programming Languages and Computer Architecture</em>, 124–44. Springer.
+<p>Meijer, Erik, Maarten Fokkinga, and Ross Paterson. 1991. <span>“Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire.”</span> In <em>Conference on Functional Programming Languages and Computer Architecture</em>, 124–44. Springer.</p>
</div>
</div>
</body>