diff options
Diffstat (limited to 'test/Tests/Readers/Txt2Tags.hs')
-rw-r--r-- | test/Tests/Readers/Txt2Tags.hs | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/test/Tests/Readers/Txt2Tags.hs b/test/Tests/Readers/Txt2Tags.hs index be6747bfe..a56f814ae 100644 --- a/test/Tests/Readers/Txt2Tags.hs +++ b/test/Tests/Readers/Txt2Tags.hs @@ -44,7 +44,18 @@ simpleTable' :: Int -> [Blocks] -> [[Blocks]] -> Blocks -simpleTable' n = table "" (replicate n (AlignCenter, ColWidthDefault)) +simpleTable' n = simpleTable'' $ replicate n (AlignCenter, ColWidthDefault) + +simpleTable'' :: [ColSpec] -> [Blocks] -> [[Blocks]] -> Blocks +simpleTable'' spec headers rows + = table emptyCaption + spec + (TableHead nullAttr $ toHeaderRow headers) + [TableBody nullAttr 0 [] $ map toRow rows] + (TableFoot nullAttr []) + where + toRow = Row nullAttr . map simpleCell + toHeaderRow l = if null l then [] else [toRow l] tests :: [TestTree] tests = @@ -398,14 +409,15 @@ tests = , "| 1 | One | foo |" , "| 2 | Two | bar |" ] =?> - table "" (zip - [AlignCenter, AlignRight, AlignDefault] - [ColWidthDefault, ColWidthDefault, ColWidthDefault]) - [] - [ [ plain "Numbers", plain "Text", plain "More" ] - , [ plain "1" , plain "One" , plain "foo" ] - , [ plain "2" , plain "Two" , plain "bar" ] - ] + simpleTable'' + (zip + [AlignCenter, AlignRight, AlignDefault] + [ColWidthDefault, ColWidthDefault, ColWidthDefault]) + [] + [ [ plain "Numbers", plain "Text", plain "More" ] + , [ plain "1" , plain "One" , plain "foo" ] + , [ plain "2" , plain "Two" , plain "bar" ] + ] , "Pipe within text doesn't start a table" =: "Ceci n'est pas une | pipe " =?> @@ -417,13 +429,14 @@ tests = , "| 1 | One | foo |" , "| 2 " ] =?> - table "" (zip - [AlignCenter, AlignLeft, AlignLeft] - [ColWidthDefault, ColWidthDefault, ColWidthDefault]) - [ plain "Numbers", plain "Text" , plain mempty ] - [ [ plain "1" , plain "One" , plain "foo" ] - , [ plain "2" , plain mempty , plain mempty ] - ] + simpleTable'' + (zip + [AlignCenter, AlignLeft, AlignLeft] + [ColWidthDefault, ColWidthDefault, ColWidthDefault]) + [ plain "Numbers", plain "Text" , plain mempty ] + [ [ plain "1" , plain "One" , plain "foo" ] + , [ plain "2" , plain mempty , plain mempty ] + ] ] |