aboutsummaryrefslogtreecommitdiff
path: root/src/Tests/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-07-26 08:37:36 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-07-26 08:37:36 -0700
commit45e4c123a45b83d666088967c25b91cf9bb5db72 (patch)
treeb3662354ccacd88b0d9238b3d0c049c4c876abc4 /src/Tests/Writers
parent3053267280bfd7b255f3bf47480e4a8a97ec2915 (diff)
downloadpandoc-45e4c123a45b83d666088967c25b91cf9bb5db72.tar.gz
Moved tests to tests/, modified cabal file so lib isn't recompiled.
Diffstat (limited to 'src/Tests/Writers')
-rw-r--r--src/Tests/Writers/ConTeXt.hs70
-rw-r--r--src/Tests/Writers/HTML.hs46
-rw-r--r--src/Tests/Writers/LaTeX.hs35
-rw-r--r--src/Tests/Writers/Markdown.hs34
-rw-r--r--src/Tests/Writers/Native.hs21
5 files changed, 0 insertions, 206 deletions
diff --git a/src/Tests/Writers/ConTeXt.hs b/src/Tests/Writers/ConTeXt.hs
deleted file mode 100644
index beb6411f0..000000000
--- a/src/Tests/Writers/ConTeXt.hs
+++ /dev/null
@@ -1,70 +0,0 @@
-{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
-module Tests.Writers.ConTeXt (tests) where
-
-import Test.Framework
-import Text.Pandoc.Builder
-import Text.Pandoc
-import Tests.Helpers
-import Tests.Arbitrary()
-
-context :: (ToString a, ToPandoc a) => a -> String
-context = writeConTeXt defaultWriterOptions . toPandoc
-
-context' :: (ToString a, ToPandoc a) => a -> String
-context' = writeConTeXt defaultWriterOptions{ writerWrapText = False }
- . toPandoc
-
-{-
- "my test" =: X =?> Y
-
-is shorthand for
-
- test context "my test" $ X =?> Y
-
-which is in turn shorthand for
-
- test context "my test" (X,Y)
--}
-
-infix 4 =:
-(=:) :: (ToString a, ToPandoc a)
- => String -> (a, String) -> Test
-(=:) = test context
-
-tests :: [Test]
-tests = [ testGroup "inline code"
- [ "with '}'" =: code "}" =?> "\\mono{\\}}"
- , "without '}'" =: code "]" =?> "\\type{]}"
- , property "code property" $ \s -> null s ||
- if '{' `elem` s || '}' `elem` s
- then (context' $ code s) == "\\mono{" ++
- (context' $ str s) ++ "}"
- else (context' $ code s) == "\\type{" ++ s ++ "}"
- ]
- , testGroup "headers"
- [ "level 1" =:
- header 1 "My header" =?> "\\section[my-header]{My header}"
- ]
- , testGroup "bullet lists"
- [ "nested" =:
- bulletList [plain (text "top")
- ,bulletList [plain (text "next")
- ,bulletList [plain (text "bot")]]]
- =?> [_LIT|
-\startitemize
-\item
- top
-\item
- \startitemize
- \item
- next
- \item
- \startitemize
- \item
- bot
- \stopitemize
- \stopitemize
-\stopitemize|]
- ]
- ]
-
diff --git a/src/Tests/Writers/HTML.hs b/src/Tests/Writers/HTML.hs
deleted file mode 100644
index 8561aa421..000000000
--- a/src/Tests/Writers/HTML.hs
+++ /dev/null
@@ -1,46 +0,0 @@
-{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
-module Tests.Writers.HTML (tests) where
-
-import Test.Framework
-import Text.Pandoc.Builder
-import Text.Pandoc
-import Tests.Helpers
-import Tests.Arbitrary()
-import Text.Pandoc.Highlighting (languages) -- null if no hl support
-
-html :: (ToString a, ToPandoc a) => a -> String
-html = writeHtmlString defaultWriterOptions{ writerWrapText = False } . toPandoc
-
-{-
- "my test" =: X =?> Y
-
-is shorthand for
-
- test html "my test" $ X =?> Y
-
-which is in turn shorthand for
-
- test html "my test" (X,Y)
--}
-
-infix 4 =:
-(=:) :: (ToString a, ToPandoc a)
- => String -> (a, String) -> Test
-(=:) = test html
-
-tests :: [Test]
-tests = [ testGroup "inline code"
- [ "basic" =: code "@&" =?> "<code>@&amp;</code>"
- , "haskell" =: codeWith ("",["haskell"],[]) ">>="
- =?> if null languages
- then "<code class=\"haskell\">&gt;&gt;=</code>"
- else "<code class=\"sourceCode haskell\"><span class=\"fu\">&gt;&gt;=</span></code>"
- , "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
- =?> "<code class=\"nolanguage\">&gt;&gt;=</code>"
- ]
- , testGroup "images"
- [ "alt with formatting" =:
- image "/url" "title" ("my " <> emph "image")
- =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
- ]
- ]
diff --git a/src/Tests/Writers/LaTeX.hs b/src/Tests/Writers/LaTeX.hs
deleted file mode 100644
index 7987716f3..000000000
--- a/src/Tests/Writers/LaTeX.hs
+++ /dev/null
@@ -1,35 +0,0 @@
-{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
-module Tests.Writers.LaTeX (tests) where
-
-import Test.Framework
-import Text.Pandoc.Builder
-import Text.Pandoc
-import Tests.Helpers
-import Tests.Arbitrary()
-
-latex :: (ToString a, ToPandoc a) => a -> String
-latex = writeLaTeX defaultWriterOptions . toPandoc
-
-{-
- "my test" =: X =?> Y
-
-is shorthand for
-
- test latex "my test" $ X =?> Y
-
-which is in turn shorthand for
-
- test latex "my test" (X,Y)
--}
-
-infix 4 =:
-(=:) :: (ToString a, ToPandoc a)
- => String -> (a, String) -> Test
-(=:) = test latex
-
-tests :: [Test]
-tests = [ testGroup "code blocks"
- [ "in footnotes" =: note (para "hi" <> codeBlock "hi") =?>
- "\\footnote{hi\n\n\\begin{Verbatim}\nhi\n\\end{Verbatim}\n}"
- ]
- ]
diff --git a/src/Tests/Writers/Markdown.hs b/src/Tests/Writers/Markdown.hs
deleted file mode 100644
index d90dc83b1..000000000
--- a/src/Tests/Writers/Markdown.hs
+++ /dev/null
@@ -1,34 +0,0 @@
-{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
-module Tests.Writers.Markdown (tests) where
-
-import Test.Framework
-import Text.Pandoc.Builder
-import Text.Pandoc
-import Tests.Helpers
-import Tests.Arbitrary()
-
-markdown :: (ToString a, ToPandoc a) => a -> String
-markdown = writeMarkdown defaultWriterOptions . toPandoc
-
-{-
- "my test" =: X =?> Y
-
-is shorthand for
-
- test markdown "my test" $ X =?> Y
-
-which is in turn shorthand for
-
- test markdown "my test" (X,Y)
--}
-
-infix 4 =:
-(=:) :: (ToString a, ToPandoc a)
- => String -> (a, String) -> Test
-(=:) = test markdown
-
-tests :: [Test]
-tests = [ "indented code after list"
- =: (orderedList [ para "one" <> para "two" ] <> codeBlock "test")
- =?> "1. one\n\n two\n\n<!-- -->\n\n test"
- ]
diff --git a/src/Tests/Writers/Native.hs b/src/Tests/Writers/Native.hs
deleted file mode 100644
index 19740e0f4..000000000
--- a/src/Tests/Writers/Native.hs
+++ /dev/null
@@ -1,21 +0,0 @@
-module Tests.Writers.Native (tests) where
-
-import Test.Framework
-import Text.Pandoc.Builder
-import Text.Pandoc
-import Tests.Helpers
-import Tests.Arbitrary()
-
-p_write_rt :: Pandoc -> Bool
-p_write_rt d =
- read (writeNative defaultWriterOptions{ writerStandalone = True } d) == d
-
-p_write_blocks_rt :: [Block] -> Bool
-p_write_blocks_rt bs = length bs > 20 ||
- read (writeNative defaultWriterOptions (Pandoc (Meta [] [] []) bs)) ==
- bs
-
-tests :: [Test]
-tests = [ property "p_write_rt" p_write_rt
- , property "p_write_blocks_rt" p_write_blocks_rt
- ]