From 00004f042c7c49197d57968cae23785ffcba5c63 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Mon, 27 Nov 2017 04:51:25 +0300 Subject: Muse reader: make code blocks round trip --- test/Tests/Readers/Muse.hs | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 1f4a9e599..19d5e0fae 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -32,16 +32,12 @@ removeTables :: Block -> Block removeTables (Table{}) = Para [Str "table was here"] removeTables x = x -removeCodeBlocks :: Block -> Block -removeCodeBlocks (CodeBlock{}) = Para [Str "table was here"] -removeCodeBlocks 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 (removeCodeBlocks . removeTables) $ Pandoc nullMeta [b] + where d = walk removeTables $ Pandoc nullMeta [b] d' = rewrite d d'' = rewrite d' d''' = rewrite d'' @@ -348,6 +344,18 @@ tests = , " " ] =?> bulletList [ codeBlock "foo" ] + , "Example inside list with empty lines" =: + T.unlines [ " - " + , " foo" + , " " + , "" + , " bar" + , "" + , " " + , " baz" + , " " + ] =?> + bulletList [ codeBlock "foo" <> para "bar" <> codeBlock "baz" ] , "Indented example inside list" =: T.unlines [ " - " , " foo" @@ -360,6 +368,18 @@ tests = , " " ] =?> definitionList [ ("foo", [codeBlock "bar"]) ] + , "Example inside list definition with empty lines" =: + T.unlines [ " term :: " + , " foo" + , " " + , "" + , " bar" + , "" + , " " + , " baz" + , " " + ] =?> + definitionList [ ("term", [codeBlock "foo" <> para "bar" <> codeBlock "baz"]) ] ] , testGroup "Literal blocks" [ test emacsMuse "Literal block" -- cgit v1.2.3