git.iko.soy/typeable/pandoc
on master help sign in
Make Txt2Tags test pass.
06eb9cfJesse Rosenthal
pandoc.cabal+2−1
@@ -518,7 +518,8 @@ Test-Suite test-pandoc
518 containers >= 0.1 && < 0.6,
518 containers >= 0.1 && < 0.6,
519 ansi-terminal >= 0.5 && < 0.7,
519 ansi-terminal >= 0.5 && < 0.7,
520 executable-path >= 0.0 && < 0.1,
520 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
522 Other-Modules: Tests.Old
523 Other-Modules: Tests.Old
523 Tests.Helpers
524 Tests.Helpers
524 Tests.Shared
525 Tests.Shared
src/Text/Pandoc/Class.hs+1
@@ -32,6 +32,7 @@ Typeclass for pandoc readers and writers, allowing both IO and pure instances.
32-}
32-}
33
33
34module Text.Pandoc.Class ( PandocMonad(..)
34module Text.Pandoc.Class ( PandocMonad(..)
35+ , CommonState(..)
35 , PureState(..)
36 , PureState(..)
36 , PureEnv(..)
37 , PureEnv(..)
37 , getPOSIXTime
38 , getPOSIXTime
tests/Tests/Readers/Txt2Tags.hs+9−4
@@ -4,16 +4,21 @@ module Tests.Readers.Txt2Tags (tests) where
4import Text.Pandoc.Definition
4import Text.Pandoc.Definition
5import Test.Framework
5import Test.Framework
6import Tests.Helpers
6import Tests.Helpers
7+import Control.Monad.State
7import Text.Pandoc.Arbitrary()
8import Text.Pandoc.Arbitrary()
8import Text.Pandoc.Builder
9import Text.Pandoc.Builder
9import Text.Pandoc
10import Text.Pandoc
10import Data.List (intersperse)
11import Data.List (intersperse)
11−import Text.Pandoc.Readers.Txt2Tags
12+import Text.Pandoc.Class
12
13
13
14
14t2t :: String -> Pandoc
15t2t :: String -> Pandoc
15-- t2t = handleError . readTxt2Tags (T2TMeta "date" "mtime" "in" "out") def
16-- t2t = handleError . readTxt2Tags (T2TMeta "date" "mtime" "in" "out") def
17+t2t = purely $ \s -> do
18+ put def { stInputFiles = Just ["in"]
19+ , stOutputFile = Just "out"
20+ }
16−t2t = purely $ readTxt2Tags def
21+ readTxt2Tags def s
17
22
18infix 4 =:
23infix 4 =:
19(=:) :: ToString c
24(=:) :: ToString c
@@ -80,10 +85,10 @@ tests =
80
85
81 , "Macros: Date" =:
86 , "Macros: Date" =:
82 "%%date" =?>
87 "%%date" =?>
83− para "date"
88+ para "1970-01-01"
84 , "Macros: Mod Time" =:
89 , "Macros: Mod Time" =:
85 "%%mtime" =?>
90 "%%mtime" =?>
86− para "mtime"
91+ para ""
87 , "Macros: Infile" =:
92 , "Macros: Infile" =:
88 "%%infile" =?>
93 "%%infile" =?>
89 para "in"
94 para "in"