Make Txt2Tags test pass.

We don't have a good way to set things that aren't in the common
state. That will be the next order of business.
This commit is contained in:
Jesse Rosenthal 2016-12-01 15:39:54 -05:00 committed by John MacFarlane
parent 4fe499d3f2
commit 06eb9cfb34
3 changed files with 12 additions and 5 deletions

View file

@ -518,7 +518,8 @@ Test-Suite test-pandoc
containers >= 0.1 && < 0.6,
ansi-terminal >= 0.5 && < 0.7,
executable-path >= 0.0 && < 0.1,
zip-archive >= 0.2.3.4 && < 0.4
zip-archive >= 0.2.3.4 && < 0.4,
mtl >= 2.2 && < 2.3
Other-Modules: Tests.Old
Tests.Helpers
Tests.Shared

View file

@ -32,6 +32,7 @@ Typeclass for pandoc readers and writers, allowing both IO and pure instances.
-}
module Text.Pandoc.Class ( PandocMonad(..)
, CommonState(..)
, PureState(..)
, PureEnv(..)
, getPOSIXTime

View file

@ -4,16 +4,21 @@ module Tests.Readers.Txt2Tags (tests) where
import Text.Pandoc.Definition
import Test.Framework
import Tests.Helpers
import Control.Monad.State
import Text.Pandoc.Arbitrary()
import Text.Pandoc.Builder
import Text.Pandoc
import Data.List (intersperse)
import Text.Pandoc.Readers.Txt2Tags
import Text.Pandoc.Class
t2t :: String -> Pandoc
-- t2t = handleError . readTxt2Tags (T2TMeta "date" "mtime" "in" "out") def
t2t = purely $ readTxt2Tags def
t2t = purely $ \s -> do
put def { stInputFiles = Just ["in"]
, stOutputFile = Just "out"
}
readTxt2Tags def s
infix 4 =:
(=:) :: ToString c
@ -80,10 +85,10 @@ tests =
, "Macros: Date" =:
"%%date" =?>
para "date"
para "1970-01-01"
, "Macros: Mod Time" =:
"%%mtime" =?>
para "mtime"
para ""
, "Macros: Infile" =:
"%%infile" =?>
para "in"