Skip to content

Commit

Permalink
Add basic test outline for the SILE Writer
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Oct 1, 2020
1 parent 82db0b7 commit a8bd012
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions pandoc.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions test/Tests/Writers/SILE.hs
Original file line number Diff line number Diff line change
@@ -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 = []
2 changes: 2 additions & 0 deletions test/test-pandoc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit a8bd012

Please sign in to comment.