From 7955c44cb33d17066c297f9f99edf5de7937e659 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 7 Feb 2009 19:20:49 +0000 Subject: Added tests for lhs writers. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1537 788f1e2b-df1e-0410-8736-df70ead52e1b --- tests/RunTests.hs | 18 +++++++++- 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 ++++++++++++ 10 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 tests/lhs-test.html create mode 100644 tests/lhs-test.html+lhs create mode 100644 tests/lhs-test.latex create mode 100644 tests/lhs-test.latex+lhs create mode 100644 tests/lhs-test.markdown create mode 100644 tests/lhs-test.markdown+lhs create mode 100644 tests/lhs-test.native create mode 100644 tests/lhs-test.rst create mode 100644 tests/lhs-test.rst+lhs 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 @@ + +

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.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 @@ + +

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.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. + + + -- cgit v1.2.3