From 42e39fbd2678fb8480b6253232ffe0258d2bae00 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 13 Feb 2018 08:55:30 +0300 Subject: Muse reader: parse definition lists with multiple descriptions --- test/Tests/Readers/Muse.hs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'test/Tests') diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 967a63ac9..5f379c44b 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -28,15 +28,9 @@ spcSep :: [Inlines] -> Inlines spcSep = mconcat . intersperse space -- Tables don't round-trip yet --- Definition lists with multiple descriptions are supported by writer, but not reader yet - -singleDescription :: ([Inline], [[Block]]) -> ([Inline], [[Block]]) -singleDescription (a, x:_) = (a, [x]) -singleDescription x = x - +-- makeRoundTrip :: Block -> Block makeRoundTrip Table{} = Para [Str "table was here"] -makeRoundTrip (DefinitionList items) = DefinitionList $ map singleDescription items makeRoundTrip x = x -- Demand that any AST produced by Muse reader and written by Muse writer can be read back exactly the same way. @@ -1092,6 +1086,25 @@ tests = ("Fourth", [ definitionList [ ("Fifth", [ para "Sixth"] ) ] ] ) ] ] ) , ("Seventh", [ para "Eighth" ]) ] + , testGroup "Definition lists with multiple descriptions" + [ "Correctly indented second description" =: + T.unlines + [ " First term :: first description" + , " :: second description" + ] =?> + definitionList [ ("First term", [ para "first description" + , para "second description" + ]) + ] + , "Incorrectly indented second description" =: + T.unlines + [ " First term :: first description" + , " :: second description" + ] =?> + definitionList [ ("First term", [ para "first description" ]) + , ("", [ para "second description" ]) + ] + ] , "Two blank lines separate definition lists" =: T.unlines [ " First :: list" -- cgit v1.2.3