Skip to content

Commit

Permalink
Add basic test outline for Sile Writer
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jan 27, 2020
1 parent 4d07a34 commit f9a1dfb
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 f9a1dfb

Please sign in to comment.