@@ -5,13 +5,13 @@ import Data.List (intersperse)
5import Data.Text (Text)
5import Data.Text (Text)
6import qualified Data.Text as T
6import qualified Data.Text as T
7import Test.Tasty
7import Test.Tasty
8−-- import Test.Tasty.QuickCheck
8+import Test.Tasty.QuickCheck
9import Tests.Helpers
9import Tests.Helpers
10import Text.Pandoc
10import Text.Pandoc
11import Text.Pandoc.Arbitrary ()
11import Text.Pandoc.Arbitrary ()
12import Text.Pandoc.Builder
12import Text.Pandoc.Builder
13import Text.Pandoc.Shared (underlineSpan)
13import Text.Pandoc.Shared (underlineSpan)
14−-- import Text.Pandoc.Walk (walk)
14+import Text.Pandoc.Walk (walk)
16amuse :: Text -> Pandoc
16amuse :: Text -> Pandoc
17amuse = purely $ readMuse def { readerExtensions = extensionsFromList [Ext_amuse]}
17amuse = purely $ readMuse def { readerExtensions = extensionsFromList [Ext_amuse]}
@@ -27,19 +27,19 @@ infix 4 =:
27spcSep :: [Inlines] -> Inlines
27spcSep :: [Inlines] -> Inlines
28spcSep = mconcat . intersperse space
28spcSep = mconcat . intersperse space
31−-- Tables and code blocks don't round-trip yet
30+-- Tables and definition lists don't round-trip yet
33−removeTables :: Block -> Block
32+makeRoundTrip :: Block -> Block
34−removeTables (Table{}) = Para [Str "table was here"]
33+makeRoundTrip (Table{}) = Para [Str "table was here"]
35−removeTables x = x
34+makeRoundTrip (DefinitionList{}) = Para [Str "deflist was here"]
37-- Demand that any AST produced by Muse reader and written by Muse writer can be read back exactly the same way.
37-- Demand that any AST produced by Muse reader and written by Muse writer can be read back exactly the same way.
38-- Currently we remove code blocks and tables and compare third rewrite to the second.
38-- Currently we remove code blocks and tables and compare third rewrite to the second.
39-- First and second rewrites are not equal yet.
39-- First and second rewrites are not equal yet.
40roundTrip :: Block -> Bool
40roundTrip :: Block -> Bool
41roundTrip b = d'' == d'''
41roundTrip b = d'' == d'''
42− where d = walk removeTables $ Pandoc nullMeta [b]
42+ where d = walk makeRoundTrip $ Pandoc nullMeta [b]
43 d' = rewrite d
43 d' = rewrite d
44 d'' = rewrite d'
44 d'' = rewrite d'
45 d''' = rewrite d''
45 d''' = rewrite d''
@@ -47,7 +47,6 @@ roundTrip b = d'' == d'''
47 (purely $ writeMuse def { writerExtensions = extensionsFromList [Ext_amuse]
47 (purely $ writeMuse def { writerExtensions = extensionsFromList [Ext_amuse]
48 , writerWrapText = WrapPreserve
48 , writerWrapText = WrapPreserve
52tests :: [TestTree]
51tests :: [TestTree]
@@ -200,7 +199,7 @@ tests =
202 , testGroup "Blocks"
201 , testGroup "Blocks"
203− [ -- testProperty "Round trip" roundTrip,
202+ [ testProperty "Round trip" roundTrip,
204 "Block elements end paragraphs" =:
203 "Block elements end paragraphs" =:
205 T.unlines [ "First paragraph"
204 T.unlines [ "First paragraph"