-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic test outline for Sile Writer
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = [] |