summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2017-12-30 20:31:34 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2017-12-30 20:32:16 +0300
commit551aec7b01cd1b76b67d889ffd3ae069b4e13faf (patch)
tree90107f8850e87159751855f87ad27b6933b33eab /test
parentbbfb6f0c3cda85588ae6a309a3402a48275e3b21 (diff)
Muse reader: enable round trip test
Closes #4107
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Readers/Muse.hs19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index abd230c8c..e9ac64a96 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -5,13 +5,13 @@ import Data.List (intersperse)
import Data.Text (Text)
import qualified Data.Text as T
import Test.Tasty
--- import Test.Tasty.QuickCheck
+import Test.Tasty.QuickCheck
import Tests.Helpers
import Text.Pandoc
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
import Text.Pandoc.Shared (underlineSpan)
--- import Text.Pandoc.Walk (walk)
+import Text.Pandoc.Walk (walk)
amuse :: Text -> Pandoc
amuse = purely $ readMuse def { readerExtensions = extensionsFromList [Ext_amuse]}
@@ -27,19 +27,19 @@ infix 4 =:
spcSep :: [Inlines] -> Inlines
spcSep = mconcat . intersperse space
-{-
--- Tables and code blocks don't round-trip yet
+-- Tables and definition lists don't round-trip yet
-removeTables :: Block -> Block
-removeTables (Table{}) = Para [Str "table was here"]
-removeTables x = x
+makeRoundTrip :: Block -> Block
+makeRoundTrip (Table{}) = Para [Str "table was here"]
+makeRoundTrip (DefinitionList{}) = Para [Str "deflist was here"]
+makeRoundTrip x = x
-- Demand that any AST produced by Muse reader and written by Muse writer can be read back exactly the same way.
-- Currently we remove code blocks and tables and compare third rewrite to the second.
-- First and second rewrites are not equal yet.
roundTrip :: Block -> Bool
roundTrip b = d'' == d'''
- where d = walk removeTables $ Pandoc nullMeta [b]
+ where d = walk makeRoundTrip $ Pandoc nullMeta [b]
d' = rewrite d
d'' = rewrite d'
d''' = rewrite d''
@@ -47,7 +47,6 @@ roundTrip b = d'' == d'''
(purely $ writeMuse def { writerExtensions = extensionsFromList [Ext_amuse]
, writerWrapText = WrapPreserve
})
--}
tests :: [TestTree]
tests =
@@ -200,7 +199,7 @@ tests =
]
, testGroup "Blocks"
- [ -- testProperty "Round trip" roundTrip,
+ [ testProperty "Round trip" roundTrip,
"Block elements end paragraphs" =:
T.unlines [ "First paragraph"
, "----"