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 Jan 27, 2020
1 parent 51ebc85 commit b8218b8
Showing 1 changed file with 37 additions and 0 deletions.
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 = []

0 comments on commit b8218b8

Please sign in to comment.