git.iko.soy/typeable/pandoc
on master help sign in
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.

commit06eb9cfb349ca6ccfde3d1938fcd13ddc65f5cb6 authorJesse Rosenthal <jrosenthal@jhu.edu> dateThu 1 Dec 2016, 15:39 (10 years ago) parent4fe499d
3 files changed+12−5
pandoc.cabal+2−1 src/Text/Pandoc/Class.hs+1 tests/Tests/Readers/Txt2Tags.hs+9−4
pandoc.cabal+2−1
@@ -518,7 +518,8 @@ Test-Suite test-pandoc
518518 containers >= 0.1 && < 0.6,
519519 ansi-terminal >= 0.5 && < 0.7,
520520 executable-path >= 0.0 && < 0.1,
521− zip-archive >= 0.2.3.4 && < 0.4
521+ zip-archive >= 0.2.3.4 && < 0.4,
522+ mtl >= 2.2 && < 2.3
522523 Other-Modules: Tests.Old
523524 Tests.Helpers
524525 Tests.Shared
src/Text/Pandoc/Class.hs+1
@@ -32,6 +32,7 @@ Typeclass for pandoc readers and writers, allowing both IO and pure instances.
3232-}
3333
3434module Text.Pandoc.Class ( PandocMonad(..)
35+ , CommonState(..)
3536 , PureState(..)
3637 , PureEnv(..)
3738 , getPOSIXTime
tests/Tests/Readers/Txt2Tags.hs+9−4
@@ -4,16 +4,21 @@ module Tests.Readers.Txt2Tags (tests) where
44import Text.Pandoc.Definition
55import Test.Framework
66import Tests.Helpers
7+import Control.Monad.State
78import Text.Pandoc.Arbitrary()
89import Text.Pandoc.Builder
910import Text.Pandoc
1011import Data.List (intersperse)
11−import Text.Pandoc.Readers.Txt2Tags
12+import Text.Pandoc.Class
1213
1314
1415t2t :: String -> Pandoc
1516-- t2t = handleError . readTxt2Tags (T2TMeta "date" "mtime" "in" "out") def
16−t2t = purely $ readTxt2Tags def
17+t2t = purely $ \s -> do
18+ put def { stInputFiles = Just ["in"]
19+ , stOutputFile = Just "out"
20+ }
21+ readTxt2Tags def s
1722
1823infix 4 =:
1924(=:) :: ToString c
@@ -80,10 +85,10 @@ tests =
8085
8186 , "Macros: Date" =:
8287 "%%date" =?>
83− para "date"
88+ para "1970-01-01"
8489 , "Macros: Mod Time" =:
8590 "%%mtime" =?>
86− para "mtime"
91+ para ""
8792 , "Macros: Infile" =:
8893 "%%infile" =?>
8994 para "in"