From f9a1dfbbe0142d7bd743c656ff482a41151afa21 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 Sile Writer --- test/Tests/Writers/Sile.hs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 test/Tests/Writers/Sile.hs diff --git a/test/Tests/Writers/Sile.hs b/test/Tests/Writers/Sile.hs new file mode 100644 index 0000000000000..d4b7afb5e946d --- /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 = []