diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2017-11-27 04:51:25 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2017-11-27 04:54:23 +0300 |
commit | 00004f042c7c49197d57968cae23785ffcba5c63 (patch) | |
tree | 68340326a8542645caa5ad49f4f16e80be245399 /test | |
parent | bdad8c1d690f791ca5ef36aee07c9874fcf50e53 (diff) | |
download | pandoc-00004f042c7c49197d57968cae23785ffcba5c63.tar.gz |
Muse reader: make code blocks round trip
Diffstat (limited to 'test')
-rw-r--r-- | test/Tests/Readers/Muse.hs | 30 |
1 files changed, 25 insertions, 5 deletions
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 = , " </example>" ] =?> bulletList [ codeBlock "foo" ] + , "Example inside list with empty lines" =: + T.unlines [ " - <example>" + , " foo" + , " </example>" + , "" + , " bar" + , "" + , " <example>" + , " baz" + , " </example>" + ] =?> + bulletList [ codeBlock "foo" <> para "bar" <> codeBlock "baz" ] , "Indented example inside list" =: T.unlines [ " - <example>" , " foo" @@ -360,6 +368,18 @@ tests = , " </example>" ] =?> definitionList [ ("foo", [codeBlock "bar"]) ] + , "Example inside list definition with empty lines" =: + T.unlines [ " term :: <example>" + , " foo" + , " </example>" + , "" + , " bar" + , "" + , " <example>" + , " baz" + , " </example>" + ] =?> + definitionList [ ("term", [codeBlock "foo" <> para "bar" <> codeBlock "baz"]) ] ] , testGroup "Literal blocks" [ test emacsMuse "Literal block" |