Added tests for lhs writers.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1537 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
dcedb2f712
commit
7955c44cb3
10 changed files with 340 additions and 1 deletions
|
@ -49,6 +49,17 @@ writerFormats = [ "native"
|
|||
, "rtf"
|
||||
]
|
||||
|
||||
lhsWriterFormats :: [String]
|
||||
lhsWriterFormats = [ "markdown"
|
||||
, "markdown+lhs"
|
||||
, "rst"
|
||||
, "rst+lhs"
|
||||
, "latex"
|
||||
, "latex+lhs"
|
||||
, "html"
|
||||
, "html+lhs"
|
||||
]
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
r1s <- mapM runWriterTest writerFormats
|
||||
|
@ -71,7 +82,8 @@ main = do
|
|||
"latex-reader.latex" "latex-reader.native"
|
||||
r11 <- runTest "native reader" ["-r", "native", "-w", "native", "-s"]
|
||||
"testsuite.native" "testsuite.native"
|
||||
let results = r1s ++ [r2, r3, r4, r5, r6, r7, r7a, r8, r9, r10, r11]
|
||||
r12s <- mapM runLhsWriterTest lhsWriterFormats
|
||||
let results = r1s ++ [r2, r3, r4, r5, r6, r7, r7a, r8, r9, r10, r11] ++ r12s
|
||||
if all id results
|
||||
then do
|
||||
putStrLn "\nAll tests passed."
|
||||
|
@ -86,6 +98,10 @@ readFile' :: FilePath -> IO String
|
|||
readFile' f = do s <- readFile f
|
||||
return $! (length s `seq` s)
|
||||
|
||||
runLhsWriterTest :: String -> IO Bool
|
||||
runLhsWriterTest format =
|
||||
runTest ("(lhs) " ++ format ++ " writer") ["-r", "native", "-s", "-w", format] "lhs-test.native" ("lhs-test" <.> format)
|
||||
|
||||
runWriterTest :: String -> IO Bool
|
||||
runWriterTest format = do
|
||||
r1 <- runTest (format ++ " writer") ["-r", "native", "-s", "-w", format] "testsuite.native" ("writer" <.> format)
|
||||
|
|
75
tests/lhs-test.html
Normal file
75
tests/lhs-test.html
Normal file
|
@ -0,0 +1,75 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
><head
|
||||
><title
|
||||
></title
|
||||
><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
|
||||
/><meta name="generator" content="pandoc"
|
||||
/><style type="text/css"
|
||||
>
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
|
||||
{ margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
|
||||
td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
pre.sourceCode { }
|
||||
pre.sourceCode span.Normal { }
|
||||
pre.sourceCode span.Keyword { color: #007020; font-weight: bold; }
|
||||
pre.sourceCode span.DataType { color: #902000; }
|
||||
pre.sourceCode span.DecVal { color: #40a070; }
|
||||
pre.sourceCode span.BaseN { color: #40a070; }
|
||||
pre.sourceCode span.Float { color: #40a070; }
|
||||
pre.sourceCode span.Char { color: #4070a0; }
|
||||
pre.sourceCode span.String { color: #4070a0; }
|
||||
pre.sourceCode span.Comment { color: #60a0b0; font-style: italic; }
|
||||
pre.sourceCode span.Others { color: #007020; }
|
||||
pre.sourceCode span.Alert { color: red; font-weight: bold; }
|
||||
pre.sourceCode span.Function { color: #06287e; }
|
||||
pre.sourceCode span.RegionMarker { }
|
||||
pre.sourceCode span.Error { color: red; font-weight: bold; }
|
||||
</style
|
||||
></head
|
||||
><body
|
||||
><h1 id="lhs-test"
|
||||
>lhs test</h1
|
||||
><p
|
||||
><code
|
||||
>unsplit</code
|
||||
> is an arrow that takes a pair of values and combines them to return a single value:</p
|
||||
><pre class="sourceCode haskell"
|
||||
><code
|
||||
><span class="Function FunctionDefinition"
|
||||
>unsplit ::</span
|
||||
><span class="Normal NormalText"
|
||||
> (Arrow a) => (b -> c -> d) -> a (b, c) d</span
|
||||
><br
|
||||
/><span class="Normal NormalText"
|
||||
>unsplit = arr . </span
|
||||
><span class="Function"
|
||||
>uncurry</span
|
||||
><span class="Normal NormalText"
|
||||
> </span
|
||||
><br
|
||||
/><span class="Normal NormalText"
|
||||
> </span
|
||||
><span class="Comment"
|
||||
>-- arr (\op (x,y) -> x `op` y) </span
|
||||
><br
|
||||
/></code
|
||||
></pre
|
||||
><p
|
||||
><code
|
||||
>(***)</code
|
||||
> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p
|
||||
><pre
|
||||
><code
|
||||
>f *** g = first f >>> second g
|
||||
</code
|
||||
></pre
|
||||
><blockquote
|
||||
><p
|
||||
>Here is a block quote section.</p
|
||||
></blockquote
|
||||
></body
|
||||
></html
|
||||
>
|
||||
|
81
tests/lhs-test.html+lhs
Normal file
81
tests/lhs-test.html+lhs
Normal file
|
@ -0,0 +1,81 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
><head
|
||||
><title
|
||||
></title
|
||||
><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
|
||||
/><meta name="generator" content="pandoc"
|
||||
/><style type="text/css"
|
||||
>
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
|
||||
{ margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
|
||||
td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
pre.sourceCode { }
|
||||
pre.sourceCode span.Normal { }
|
||||
pre.sourceCode span.Keyword { color: #007020; font-weight: bold; }
|
||||
pre.sourceCode span.DataType { color: #902000; }
|
||||
pre.sourceCode span.DecVal { color: #40a070; }
|
||||
pre.sourceCode span.BaseN { color: #40a070; }
|
||||
pre.sourceCode span.Float { color: #40a070; }
|
||||
pre.sourceCode span.Char { color: #4070a0; }
|
||||
pre.sourceCode span.String { color: #4070a0; }
|
||||
pre.sourceCode span.Comment { color: #60a0b0; font-style: italic; }
|
||||
pre.sourceCode span.Others { color: #007020; }
|
||||
pre.sourceCode span.Alert { color: red; font-weight: bold; }
|
||||
pre.sourceCode span.Function { color: #06287e; }
|
||||
pre.sourceCode span.RegionMarker { }
|
||||
pre.sourceCode span.Error { color: red; font-weight: bold; }
|
||||
</style
|
||||
></head
|
||||
><body
|
||||
><h1 id="lhs-test"
|
||||
>lhs test</h1
|
||||
><p
|
||||
><code
|
||||
>unsplit</code
|
||||
> is an arrow that takes a pair of values and combines them to return a single value:</p
|
||||
><pre class="sourceCode literatehaskell"
|
||||
><code
|
||||
><span class="Char Special"
|
||||
>></span
|
||||
><span class="Function FunctionDefinition"
|
||||
> unsplit ::</span
|
||||
><span class="Normal NormalText"
|
||||
> (Arrow a) => (b -> c -> d) -> a (b, c) d</span
|
||||
><br
|
||||
/><span class="Char Special"
|
||||
>></span
|
||||
><span class="Normal NormalText"
|
||||
> unsplit = arr . </span
|
||||
><span class="Function"
|
||||
>uncurry</span
|
||||
><span class="Normal NormalText"
|
||||
> </span
|
||||
><br
|
||||
/><span class="Char Special"
|
||||
>></span
|
||||
><span class="Normal NormalText"
|
||||
> </span
|
||||
><span class="Comment"
|
||||
>-- arr (\op (x,y) -> x `op` y) </span
|
||||
><br
|
||||
/></code
|
||||
></pre
|
||||
><p
|
||||
><code
|
||||
>(***)</code
|
||||
> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p
|
||||
><pre
|
||||
><code
|
||||
>f *** g = first f >>> second g
|
||||
</code
|
||||
></pre
|
||||
><blockquote
|
||||
><p
|
||||
>Here is a block quote section.</p
|
||||
></blockquote
|
||||
></body
|
||||
></html
|
||||
>
|
||||
|
36
tests/lhs-test.latex
Normal file
36
tests/lhs-test.latex
Normal file
|
@ -0,0 +1,36 @@
|
|||
\documentclass{article}
|
||||
\usepackage{amsmath}
|
||||
\usepackage[mathletters]{ucs}
|
||||
\usepackage[utf8x]{inputenc}
|
||||
\usepackage{listings}
|
||||
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{6pt plus 2pt minus 1pt}
|
||||
|
||||
|
||||
\setcounter{secnumdepth}{0}
|
||||
\author{}
|
||||
\begin{document}
|
||||
|
||||
\section{lhs test}
|
||||
|
||||
\verb!unsplit! is an arrow that takes a pair of values and combines
|
||||
them to return a single value:
|
||||
|
||||
\begin{verbatim}
|
||||
unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
|
||||
unsplit = arr . uncurry
|
||||
-- arr (\op (x,y) -> x `op` y)
|
||||
\end{verbatim}
|
||||
\verb!(***)! combines two arrows into a new arrow by running the
|
||||
two arrows on a pair of values (one arrow on the first item of the
|
||||
pair and one arrow on the second item of the pair).
|
||||
|
||||
\begin{verbatim}
|
||||
f *** g = first f >>> second g
|
||||
\end{verbatim}
|
||||
\begin{quote}
|
||||
Here is a block quote section.
|
||||
|
||||
\end{quote}
|
||||
\end{document}
|
36
tests/lhs-test.latex+lhs
Normal file
36
tests/lhs-test.latex+lhs
Normal file
|
@ -0,0 +1,36 @@
|
|||
\documentclass{article}
|
||||
\usepackage{amsmath}
|
||||
\usepackage[mathletters]{ucs}
|
||||
\usepackage[utf8x]{inputenc}
|
||||
\usepackage{listings}
|
||||
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{6pt plus 2pt minus 1pt}
|
||||
|
||||
|
||||
\setcounter{secnumdepth}{0}
|
||||
\author{}
|
||||
\begin{document}
|
||||
|
||||
\section{lhs test}
|
||||
|
||||
\verb!unsplit! is an arrow that takes a pair of values and combines
|
||||
them to return a single value:
|
||||
|
||||
\begin{code}
|
||||
unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
|
||||
unsplit = arr . uncurry
|
||||
-- arr (\op (x,y) -> x `op` y)
|
||||
\end{code}
|
||||
\verb!(***)! combines two arrows into a new arrow by running the
|
||||
two arrows on a pair of values (one arrow on the first item of the
|
||||
pair and one arrow on the second item of the pair).
|
||||
|
||||
\begin{verbatim}
|
||||
f *** g = first f >>> second g
|
||||
\end{verbatim}
|
||||
\begin{quote}
|
||||
Here is a block quote section.
|
||||
|
||||
\end{quote}
|
||||
\end{document}
|
19
tests/lhs-test.markdown
Normal file
19
tests/lhs-test.markdown
Normal file
|
@ -0,0 +1,19 @@
|
|||
# lhs test
|
||||
|
||||
`unsplit` is an arrow that takes a pair of values and combines them
|
||||
to return a single value:
|
||||
|
||||
unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
|
||||
unsplit = arr . uncurry
|
||||
-- arr (\op (x,y) -> x `op` y)
|
||||
|
||||
`(***)` combines two arrows into a new arrow by running the two
|
||||
arrows on a pair of values (one arrow on the first item of the pair
|
||||
and one arrow on the second item of the pair).
|
||||
|
||||
f *** g = first f >>> second g
|
||||
|
||||
> Here is a block quote section.
|
||||
|
||||
|
||||
|
20
tests/lhs-test.markdown+lhs
Normal file
20
tests/lhs-test.markdown+lhs
Normal file
|
@ -0,0 +1,20 @@
|
|||
lhs test
|
||||
========
|
||||
|
||||
`unsplit` is an arrow that takes a pair of values and combines them
|
||||
to return a single value:
|
||||
|
||||
> unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
|
||||
> unsplit = arr . uncurry
|
||||
> -- arr (\op (x,y) -> x `op` y)
|
||||
|
||||
`(***)` combines two arrows into a new arrow by running the two
|
||||
arrows on a pair of values (one arrow on the first item of the pair
|
||||
and one arrow on the second item of the pair).
|
||||
|
||||
f *** g = first f >>> second g
|
||||
|
||||
> Here is a block quote section.
|
||||
|
||||
|
||||
|
10
tests/lhs-test.native
Normal file
10
tests/lhs-test.native
Normal file
|
@ -0,0 +1,10 @@
|
|||
Pandoc (Meta [] [] "")
|
||||
[ Header 1 [Str "lhs",Space,Str "test"]
|
||||
, Para [Code "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",Space,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]
|
||||
, CodeBlock ("",["sourceCode","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry \n -- arr (\\op (x,y) -> x `op` y) "
|
||||
, Para [Code "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)",Str "."]
|
||||
, CodeBlock ("",[],[]) "f *** g = first f >>> second g"
|
||||
, BlockQuote
|
||||
[ Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote",Space,Str "section",Str "."] ]
|
||||
]
|
||||
|
24
tests/lhs-test.rst
Normal file
24
tests/lhs-test.rst
Normal file
|
@ -0,0 +1,24 @@
|
|||
lhs test
|
||||
========
|
||||
|
||||
``unsplit`` is an arrow that takes a pair of values and combines
|
||||
them to return a single value:
|
||||
|
||||
::
|
||||
|
||||
unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
|
||||
unsplit = arr . uncurry
|
||||
-- arr (\op (x,y) -> x `op` y)
|
||||
|
||||
``(***)`` combines two arrows into a new arrow by running the two
|
||||
arrows on a pair of values (one arrow on the first item of the pair
|
||||
and one arrow on the second item of the pair).
|
||||
|
||||
::
|
||||
|
||||
f *** g = first f >>> second g
|
||||
|
||||
Here is a block quote section.
|
||||
|
||||
|
||||
|
22
tests/lhs-test.rst+lhs
Normal file
22
tests/lhs-test.rst+lhs
Normal file
|
@ -0,0 +1,22 @@
|
|||
lhs test
|
||||
========
|
||||
|
||||
``unsplit`` is an arrow that takes a pair of values and combines
|
||||
them to return a single value:
|
||||
|
||||
> unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
|
||||
> unsplit = arr . uncurry
|
||||
> -- arr (\op (x,y) -> x `op` y)
|
||||
|
||||
``(***)`` combines two arrows into a new arrow by running the two
|
||||
arrows on a pair of values (one arrow on the first item of the pair
|
||||
and one arrow on the second item of the pair).
|
||||
|
||||
::
|
||||
|
||||
f *** g = first f >>> second g
|
||||
|
||||
Here is a block quote section.
|
||||
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue