LaTeX reader: add some test cases for simple tables
This commit is contained in:
parent
efdc1691fa
commit
4f9a10619f
1 changed files with 31 additions and 0 deletions
|
@ -7,6 +7,7 @@ import Tests.Helpers
|
|||
import Tests.Arbitrary()
|
||||
import Text.Pandoc.Builder
|
||||
import Text.Pandoc
|
||||
import Data.Monoid (mempty)
|
||||
|
||||
latex :: String -> Pandoc
|
||||
latex = readLaTeX def
|
||||
|
@ -16,6 +17,10 @@ infix 4 =:
|
|||
=> String -> (String, c) -> Test
|
||||
(=:) = test latex
|
||||
|
||||
simpleTable' :: [Alignment] -> [[Blocks]] -> Blocks
|
||||
simpleTable' aligns = table "" (zip aligns (repeat 0.0))
|
||||
(map (const mempty) aligns)
|
||||
|
||||
tests :: [Test]
|
||||
tests = [ testGroup "basic"
|
||||
[ "simple" =:
|
||||
|
@ -62,6 +67,32 @@ tests = [ testGroup "basic"
|
|||
"\\begin{lstlisting}\\end{lstlisting}" =?> codeBlock ""
|
||||
]
|
||||
|
||||
, testGroup "tables"
|
||||
[ "Single cell table" =:
|
||||
"\\begin{tabular}{|l|}Test\\\\\\end{tabular}" =?>
|
||||
simpleTable' [AlignLeft] [[plain "Test"]]
|
||||
, "Multi cell table" =:
|
||||
"\\begin{tabular}{|rl|}One & Two\\\\ \\end{tabular}" =?>
|
||||
simpleTable' [AlignRight,AlignLeft] [[plain "One", plain "Two"]]
|
||||
, "Multi line table" =:
|
||||
unlines [ "\\begin{tabular}{|c|}"
|
||||
, "One\\\\"
|
||||
, "Two\\\\"
|
||||
, "Three\\\\"
|
||||
, "\\end{tabular}" ] =?>
|
||||
simpleTable' [AlignCenter]
|
||||
[[plain "One"], [plain "Two"], [plain "Three"]]
|
||||
, "Empty table" =:
|
||||
"\\begin{tabular}{}\\end{tabular}" =?>
|
||||
simpleTable' [] []
|
||||
, "Table with fixed column width" =:
|
||||
"\\begin{tabular}{|p{5cm}r|}One & Two\\\\ \\end{tabular}" =?>
|
||||
simpleTable' [AlignLeft,AlignRight] [[plain "One", plain "Two"]]
|
||||
, "Table with empty column separators" =:
|
||||
"\\begin{tabular}{@{}r@{}l}One & Two\\\\ \\end{tabular}" =?>
|
||||
simpleTable' [AlignRight,AlignLeft] [[plain "One", plain "Two"]]
|
||||
]
|
||||
|
||||
, testGroup "citations"
|
||||
[ natbibCitations
|
||||
, biblatexCitations
|
||||
|
|
Loading…
Add table
Reference in a new issue