git.iko.soy/typeable/pandoc
on master help sign in
Added tests for lhs writers.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1537 788f1e2b-df1e-0410-8736-df70ead52e1b

commit7955c44cb33d17066c297f9f99edf5de7937e659 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 7 Feb 2009, 19:20 (18 years ago) parentdcedb2f
10 files changed+340−1
tests/RunTests.hs+17−1 tests/lhs-test.html+75 tests/lhs-test.html+lhs+81 tests/lhs-test.latex+36 tests/lhs-test.latex+lhs+36 tests/lhs-test.markdown+19 tests/lhs-test.markdown+lhs+20 tests/lhs-test.native+10 tests/lhs-test.rst+24 tests/lhs-test.rst+lhs+22
tests/RunTests.hs+17−1
@@ -49,6 +49,17 @@ writerFormats = [ "native"
4949 , "rtf"
5050 ]
5151
52+lhsWriterFormats :: [String]
53+lhsWriterFormats = [ "markdown"
54+ , "markdown+lhs"
55+ , "rst"
56+ , "rst+lhs"
57+ , "latex"
58+ , "latex+lhs"
59+ , "html"
60+ , "html+lhs"
61+ ]
62+
5263main :: IO ()
5364main = do
5465 r1s <- mapM runWriterTest writerFormats
@@ -71,7 +82,8 @@ main = do
7182 "latex-reader.latex" "latex-reader.native"
7283 r11 <- runTest "native reader" ["-r", "native", "-w", "native", "-s"]
7384 "testsuite.native" "testsuite.native"
74− let results = r1s ++ [r2, r3, r4, r5, r6, r7, r7a, r8, r9, r10, r11]
85+ r12s <- mapM runLhsWriterTest lhsWriterFormats
86+ let results = r1s ++ [r2, r3, r4, r5, r6, r7, r7a, r8, r9, r10, r11] ++ r12s
7587 if all id results
7688 then do
7789 putStrLn "\nAll tests passed."
@@ -86,6 +98,10 @@ readFile' :: FilePath -> IO String
8698readFile' f = do s <- readFile f
8799 return $! (length s `seq` s)
88100
101+runLhsWriterTest :: String -> IO Bool
102+runLhsWriterTest format =
103+ runTest ("(lhs) " ++ format ++ " writer") ["-r", "native", "-s", "-w", format] "lhs-test.native" ("lhs-test" <.> format)
104+
89105runWriterTest :: String -> IO Bool
90106runWriterTest format = do
91107 r1 <- runTest (format ++ " writer") ["-r", "native", "-s", "-w", format] "testsuite.native" ("writer" <.> format)
tests/lhs-test.htmlnew file+75
@@ -0,0 +1,75 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+<html xmlns="http://www.w3.org/1999/xhtml"
3+><head
4+ ><title
5+ ></title
6+ ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
7+ /><meta name="generator" content="pandoc"
8+ /><style type="text/css"
9+ >
10+table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
11+ { margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
12+td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
13+td.sourceCode { padding-left: 5px; }
14+pre.sourceCode { }
15+pre.sourceCode span.Normal { }
16+pre.sourceCode span.Keyword { color: #007020; font-weight: bold; }
17+pre.sourceCode span.DataType { color: #902000; }
18+pre.sourceCode span.DecVal { color: #40a070; }
19+pre.sourceCode span.BaseN { color: #40a070; }
20+pre.sourceCode span.Float { color: #40a070; }
21+pre.sourceCode span.Char { color: #4070a0; }
22+pre.sourceCode span.String { color: #4070a0; }
23+pre.sourceCode span.Comment { color: #60a0b0; font-style: italic; }
24+pre.sourceCode span.Others { color: #007020; }
25+pre.sourceCode span.Alert { color: red; font-weight: bold; }
26+pre.sourceCode span.Function { color: #06287e; }
27+pre.sourceCode span.RegionMarker { }
28+pre.sourceCode span.Error { color: red; font-weight: bold; }
29+</style
30+ ></head
31+ ><body
32+ ><h1 id="lhs-test"
33+ >lhs test</h1
34+ ><p
35+ ><code
36+ >unsplit</code
37+ > is an arrow that takes a pair of values and combines them to return a single value:</p
38+ ><pre class="sourceCode haskell"
39+ ><code
40+ ><span class="Function FunctionDefinition"
41+ >unsplit ::</span
42+ ><span class="Normal NormalText"
43+ > (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span
44+ ><br
45+ /><span class="Normal NormalText"
46+ >unsplit = arr . </span
47+ ><span class="Function"
48+ >uncurry</span
49+ ><span class="Normal NormalText"
50+ > </span
51+ ><br
52+ /><span class="Normal NormalText"
53+ > </span
54+ ><span class="Comment"
55+ >-- arr (\op (x,y) -&gt; x `op` y) </span
56+ ><br
57+ /></code
58+ ></pre
59+ ><p
60+ ><code
61+ >(***)</code
62+ > 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
63+ ><pre
64+ ><code
65+ >f *** g = first f &gt;&gt;&gt; second g
66+</code
67+ ></pre
68+ ><blockquote
69+ ><p
70+ >Here is a block quote section.</p
71+ ></blockquote
72+ ></body
73+ ></html
74+>
75+
tests/lhs-test.html+lhsnew file+81
@@ -0,0 +1,81 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+<html xmlns="http://www.w3.org/1999/xhtml"
3+><head
4+ ><title
5+ ></title
6+ ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
7+ /><meta name="generator" content="pandoc"
8+ /><style type="text/css"
9+ >
10+table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
11+ { margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
12+td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
13+td.sourceCode { padding-left: 5px; }
14+pre.sourceCode { }
15+pre.sourceCode span.Normal { }
16+pre.sourceCode span.Keyword { color: #007020; font-weight: bold; }
17+pre.sourceCode span.DataType { color: #902000; }
18+pre.sourceCode span.DecVal { color: #40a070; }
19+pre.sourceCode span.BaseN { color: #40a070; }
20+pre.sourceCode span.Float { color: #40a070; }
21+pre.sourceCode span.Char { color: #4070a0; }
22+pre.sourceCode span.String { color: #4070a0; }
23+pre.sourceCode span.Comment { color: #60a0b0; font-style: italic; }
24+pre.sourceCode span.Others { color: #007020; }
25+pre.sourceCode span.Alert { color: red; font-weight: bold; }
26+pre.sourceCode span.Function { color: #06287e; }
27+pre.sourceCode span.RegionMarker { }
28+pre.sourceCode span.Error { color: red; font-weight: bold; }
29+</style
30+ ></head
31+ ><body
32+ ><h1 id="lhs-test"
33+ >lhs test</h1
34+ ><p
35+ ><code
36+ >unsplit</code
37+ > is an arrow that takes a pair of values and combines them to return a single value:</p
38+ ><pre class="sourceCode literatehaskell"
39+ ><code
40+ ><span class="Char Special"
41+ >&gt;</span
42+ ><span class="Function FunctionDefinition"
43+ > unsplit ::</span
44+ ><span class="Normal NormalText"
45+ > (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span
46+ ><br
47+ /><span class="Char Special"
48+ >&gt;</span
49+ ><span class="Normal NormalText"
50+ > unsplit = arr . </span
51+ ><span class="Function"
52+ >uncurry</span
53+ ><span class="Normal NormalText"
54+ > </span
55+ ><br
56+ /><span class="Char Special"
57+ >&gt;</span
58+ ><span class="Normal NormalText"
59+ > </span
60+ ><span class="Comment"
61+ >-- arr (\op (x,y) -&gt; x `op` y) </span
62+ ><br
63+ /></code
64+ ></pre
65+ ><p
66+ ><code
67+ >(***)</code
68+ > 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
69+ ><pre
70+ ><code
71+ >f *** g = first f &gt;&gt;&gt; second g
72+</code
73+ ></pre
74+ ><blockquote
75+ ><p
76+ >Here is a block quote section.</p
77+ ></blockquote
78+ ></body
79+ ></html
80+>
81+
tests/lhs-test.latexnew file+36
@@ -0,0 +1,36 @@
1+\documentclass{article}
2+\usepackage{amsmath}
3+\usepackage[mathletters]{ucs}
4+\usepackage[utf8x]{inputenc}
5+\usepackage{listings}
6+\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
7+\setlength{\parindent}{0pt}
8+\setlength{\parskip}{6pt plus 2pt minus 1pt}
9+
10+
11+\setcounter{secnumdepth}{0}
12+\author{}
13+\begin{document}
14+
15+\section{lhs test}
16+
17+\verb!unsplit! is an arrow that takes a pair of values and combines
18+them to return a single value:
19+
20+\begin{verbatim}
21+unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
22+unsplit = arr . uncurry
23+ -- arr (\op (x,y) -> x `op` y)
24+\end{verbatim}
25+\verb!(***)! combines two arrows into a new arrow by running the
26+two arrows on a pair of values (one arrow on the first item of the
27+pair and one arrow on the second item of the pair).
28+
29+\begin{verbatim}
30+f *** g = first f >>> second g
31+\end{verbatim}
32+\begin{quote}
33+Here is a block quote section.
34+
35+\end{quote}
36+\end{document}
tests/lhs-test.latex+lhsnew file+36
@@ -0,0 +1,36 @@
1+\documentclass{article}
2+\usepackage{amsmath}
3+\usepackage[mathletters]{ucs}
4+\usepackage[utf8x]{inputenc}
5+\usepackage{listings}
6+\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
7+\setlength{\parindent}{0pt}
8+\setlength{\parskip}{6pt plus 2pt minus 1pt}
9+
10+
11+\setcounter{secnumdepth}{0}
12+\author{}
13+\begin{document}
14+
15+\section{lhs test}
16+
17+\verb!unsplit! is an arrow that takes a pair of values and combines
18+them to return a single value:
19+
20+\begin{code}
21+unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
22+unsplit = arr . uncurry
23+ -- arr (\op (x,y) -> x `op` y)
24+\end{code}
25+\verb!(***)! combines two arrows into a new arrow by running the
26+two arrows on a pair of values (one arrow on the first item of the
27+pair and one arrow on the second item of the pair).
28+
29+\begin{verbatim}
30+f *** g = first f >>> second g
31+\end{verbatim}
32+\begin{quote}
33+Here is a block quote section.
34+
35+\end{quote}
36+\end{document}
tests/lhs-test.markdownnew file+19
@@ -0,0 +1,19 @@
1+# lhs test
2+
3+`unsplit` is an arrow that takes a pair of values and combines them
4+to return a single value:
5+
6+ unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
7+ unsplit = arr . uncurry
8+ -- arr (\op (x,y) -> x `op` y)
9+
10+`(***)` combines two arrows into a new arrow by running the two
11+arrows on a pair of values (one arrow on the first item of the pair
12+and one arrow on the second item of the pair).
13+
14+ f *** g = first f >>> second g
15+
16+> Here is a block quote section.
17+
18+
19+
tests/lhs-test.markdown+lhsnew file+20
@@ -0,0 +1,20 @@
1+lhs test
2+========
3+
4+`unsplit` is an arrow that takes a pair of values and combines them
5+to return a single value:
6+
7+> unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
8+> unsplit = arr . uncurry
9+> -- arr (\op (x,y) -> x `op` y)
10+
11+`(***)` combines two arrows into a new arrow by running the two
12+arrows on a pair of values (one arrow on the first item of the pair
13+and one arrow on the second item of the pair).
14+
15+ f *** g = first f >>> second g
16+
17+ > Here is a block quote section.
18+
19+
20+
tests/lhs-test.nativenew file+10
@@ -0,0 +1,10 @@
1+Pandoc (Meta [] [] "")
2+[ Header 1 [Str "lhs",Space,Str "test"]
3+, 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:"]
4+, CodeBlock ("",["sourceCode","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry \n -- arr (\\op (x,y) -> x `op` y) "
5+, 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 "."]
6+, CodeBlock ("",[],[]) "f *** g = first f >>> second g"
7+, BlockQuote
8+ [ Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote",Space,Str "section",Str "."] ]
9+ ]
10+
tests/lhs-test.rstnew file+24
@@ -0,0 +1,24 @@
1+lhs test
2+========
3+
4+``unsplit`` is an arrow that takes a pair of values and combines
5+them to return a single value:
6+
7+::
8+
9+ unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
10+ unsplit = arr . uncurry
11+ -- arr (\op (x,y) -> x `op` y)
12+
13+``(***)`` combines two arrows into a new arrow by running the two
14+arrows on a pair of values (one arrow on the first item of the pair
15+and one arrow on the second item of the pair).
16+
17+::
18+
19+ f *** g = first f >>> second g
20+
21+ Here is a block quote section.
22+
23+
24+
tests/lhs-test.rst+lhsnew file+22
@@ -0,0 +1,22 @@
1+lhs test
2+========
3+
4+``unsplit`` is an arrow that takes a pair of values and combines
5+them to return a single value:
6+
7+> unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
8+> unsplit = arr . uncurry
9+> -- arr (\op (x,y) -> x `op` y)
10+
11+``(***)`` combines two arrows into a new arrow by running the two
12+arrows on a pair of values (one arrow on the first item of the pair
13+and one arrow on the second item of the pair).
14+
15+::
16+
17+ f *** g = first f >>> second g
18+
19+ Here is a block quote section.
20+
21+
22+