From 87e93c6c95b86b435b532286e07b0a9b896aef8f Mon Sep 17 00:00:00 2001 From: Alexander Batischev Date: Wed, 30 Dec 2020 15:48:40 +0300 Subject: Fix golden test failing with pandoc >= 2.11.3 (#829) The new version started wrapping Biblio references into

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. --- hakyll.cabal | 2 ++ tests/Hakyll/Web/Pandoc/Biblio/Tests.hs | 5 +++++ tests/data/biblio/biblio01-pre-pandoc-2.11.3.golden | 16 ++++++++++++++++ tests/data/biblio/biblio01.golden | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/data/biblio/biblio01-pre-pandoc-2.11.3.golden diff --git a/hakyll.cabal b/hakyll.cabal index 66eec1d..d8f44f7 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -299,6 +299,8 @@ Test-suite hakyll-tests Other-modules: Hakyll.Web.Pandoc.Biblio.Tests Hakyll.Web.Pandoc.FileType.Tests + Build-Depends: + pandoc >= 2.11 && < 2.12 Cpp-options: -DUSE_PANDOC 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 @@ + + + + + This page cites a paper. + + +

This page cites a paper.

+

I would like to cite one of my favourite papers (Meijer, Fokkinga, and Paterson 1991) here.

+
+
+Meijer, Erik, Maarten Fokkinga, and Ross Paterson. 1991. “Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire.” In Conference on Functional Programming Languages and Computer Architecture, 124–44. Springer. +
+
+ + 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 @@

I would like to cite one of my favourite papers (Meijer, Fokkinga, and Paterson 1991) here.

-Meijer, Erik, Maarten Fokkinga, and Ross Paterson. 1991. “Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire.” In Conference on Functional Programming Languages and Computer Architecture, 124–44. Springer. +

Meijer, Erik, Maarten Fokkinga, and Ross Paterson. 1991. “Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire.” In Conference on Functional Programming Languages and Computer Architecture, 124–44. Springer.

-- cgit v1.2.3