diff options
-rw-r--r-- | tests/RunTests.hs | 18 | ||||
-rw-r--r-- | tests/lhs-test.html | 75 | ||||
-rw-r--r-- | tests/lhs-test.html+lhs | 81 | ||||
-rw-r--r-- | tests/lhs-test.latex | 36 | ||||
-rw-r--r-- | tests/lhs-test.latex+lhs | 36 | ||||
-rw-r--r-- | tests/lhs-test.markdown | 19 | ||||
-rw-r--r-- | tests/lhs-test.markdown+lhs | 20 | ||||
-rw-r--r-- | tests/lhs-test.native | 10 | ||||
-rw-r--r-- | tests/lhs-test.rst | 24 | ||||
-rw-r--r-- | tests/lhs-test.rst+lhs | 22 |
10 files changed, 340 insertions, 1 deletions
diff --git a/tests/RunTests.hs b/tests/RunTests.hs index 6579077f1..3645b9dfe 100644 --- a/tests/RunTests.hs +++ b/tests/RunTests.hs @@ -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) diff --git a/tests/lhs-test.html b/tests/lhs-test.html new file mode 100644 index 000000000..695165fd6 --- /dev/null +++ b/tests/lhs-test.html @@ -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 +> + diff --git a/tests/lhs-test.html+lhs b/tests/lhs-test.html+lhs new file mode 100644 index 000000000..1cda84cdb --- /dev/null +++ b/tests/lhs-test.html+lhs @@ -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 +> + diff --git a/tests/lhs-test.latex b/tests/lhs-test.latex new file mode 100644 index 000000000..73273765a --- /dev/null +++ b/tests/lhs-test.latex @@ -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} diff --git a/tests/lhs-test.latex+lhs b/tests/lhs-test.latex+lhs new file mode 100644 index 000000000..203955d1a --- /dev/null +++ b/tests/lhs-test.latex+lhs @@ -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} diff --git a/tests/lhs-test.markdown b/tests/lhs-test.markdown new file mode 100644 index 000000000..2b3223493 --- /dev/null +++ b/tests/lhs-test.markdown @@ -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. + + + diff --git a/tests/lhs-test.markdown+lhs b/tests/lhs-test.markdown+lhs new file mode 100644 index 000000000..9d6714e44 --- /dev/null +++ b/tests/lhs-test.markdown+lhs @@ -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. + + + diff --git a/tests/lhs-test.native b/tests/lhs-test.native new file mode 100644 index 000000000..6993d10de --- /dev/null +++ b/tests/lhs-test.native @@ -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 "."] ] + ] + diff --git a/tests/lhs-test.rst b/tests/lhs-test.rst new file mode 100644 index 000000000..0cde4237a --- /dev/null +++ b/tests/lhs-test.rst @@ -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. + + + diff --git a/tests/lhs-test.rst+lhs b/tests/lhs-test.rst+lhs new file mode 100644 index 000000000..9d2f1cbcb --- /dev/null +++ b/tests/lhs-test.rst+lhs @@ -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. + + + |