From a8bd01237db0bd0dbf5bd7e652dcf02b588fb440 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 27 Jan 2020 14:39:28 +0300 Subject: [PATCH] Add basic test outline for the SILE Writer --- pandoc.cabal | 1 + test/Tests/Writers/SILE.hs | 37 +++++++++++++++++++++++++++++++++++++ test/test-pandoc.hs | 2 ++ 3 files changed, 40 insertions(+) create mode 100644 test/Tests/Writers/SILE.hs diff --git a/pandoc.cabal b/pandoc.cabal index acf6a44623fe..1fccf445bb09 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -839,6 +839,7 @@ test-suite test-pandoc Tests.Writers.LaTeX Tests.Writers.Docx Tests.Writers.RST + Tests.Writers.SILE Tests.Writers.TEI Tests.Writers.Muse Tests.Writers.FB2 diff --git a/test/Tests/Writers/SILE.hs b/test/Tests/Writers/SILE.hs new file mode 100644 index 000000000000..e85f7b291ac6 --- /dev/null +++ b/test/Tests/Writers/SILE.hs @@ -0,0 +1,37 @@ +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE OverloadedStrings #-} +module Tests.Writers.SILE (tests) where + +import Prelude +import Data.Text (unpack) +import Test.Tasty +import Tests.Helpers +import Text.Pandoc +import Text.Pandoc.Arbitrary () +import Text.Pandoc.Builder + +sile :: (ToPandoc a) => a -> String +sile = sileWithOpts def + +sileWithOpts :: (ToPandoc a) => WriterOptions -> a -> String +sileWithOpts opts = unpack . purely (writeSILE opts) . toPandoc + +{- + "my test" =: X =?> Y + +is shorthand for + + test sile "my test" $ X =?> Y + +which is in turn shorthand for + + test sile "my test" (X,Y) +-} + +infix 4 =: +(=:) :: (ToString a, ToPandoc a) + => String -> (a, String) -> TestTree +(=:) = test sile + +tests :: [TestTree] +tests = [] diff --git a/test/test-pandoc.hs b/test/test-pandoc.hs index bb4db90b9409..224492756da2 100644 --- a/test/test-pandoc.hs +++ b/test/test-pandoc.hs @@ -45,6 +45,7 @@ import qualified Tests.Writers.Plain import qualified Tests.Writers.Powerpoint import qualified Tests.Writers.RST import qualified Tests.Writers.AnnotatedTable +import qualified Tests.Writers.SILE import qualified Tests.Writers.TEI import Tests.Helpers (findPandoc) import Text.Pandoc.Shared (inDirectory) @@ -68,6 +69,7 @@ tests pandocPath = testGroup "pandoc tests" , testGroup "AsciiDoc" Tests.Writers.AsciiDoc.tests , testGroup "Docx" Tests.Writers.Docx.tests , testGroup "RST" Tests.Writers.RST.tests + , testGroup "SILE" Tests.Writers.SILE.tests , testGroup "TEI" Tests.Writers.TEI.tests , testGroup "Muse" Tests.Writers.Muse.tests , testGroup "FB2" Tests.Writers.FB2.tests