diff options
Diffstat (limited to 'test/Tests/Writers')
-rw-r--r-- | test/Tests/Writers/AsciiDoc.hs | 4 | ||||
-rw-r--r-- | test/Tests/Writers/ConTeXt.hs | 9 | ||||
-rw-r--r-- | test/Tests/Writers/Docbook.hs | 6 | ||||
-rw-r--r-- | test/Tests/Writers/Docx.hs | 17 | ||||
-rw-r--r-- | test/Tests/Writers/HTML.hs | 6 | ||||
-rw-r--r-- | test/Tests/Writers/LaTeX.hs | 6 | ||||
-rw-r--r-- | test/Tests/Writers/Markdown.hs | 12 | ||||
-rw-r--r-- | test/Tests/Writers/Muse.hs | 6 | ||||
-rw-r--r-- | test/Tests/Writers/Native.hs | 9 | ||||
-rw-r--r-- | test/Tests/Writers/Org.hs | 6 | ||||
-rw-r--r-- | test/Tests/Writers/Plain.hs | 6 | ||||
-rw-r--r-- | test/Tests/Writers/RST.hs | 6 | ||||
-rw-r--r-- | test/Tests/Writers/TEI.hs | 6 |
13 files changed, 51 insertions, 48 deletions
diff --git a/test/Tests/Writers/AsciiDoc.hs b/test/Tests/Writers/AsciiDoc.hs index b4869d628..02ecb08f4 100644 --- a/test/Tests/Writers/AsciiDoc.hs +++ b/test/Tests/Writers/AsciiDoc.hs @@ -1,6 +1,6 @@ module Tests.Writers.AsciiDoc (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -9,7 +9,7 @@ import Text.Pandoc.Builder asciidoc :: (ToPandoc a) => a -> String asciidoc = purely (writeAsciiDoc def{ writerWrapText = WrapNone }) . toPandoc -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "emphasis" [ test asciidoc "emph word before" $ para (text "foo" <> emph (text "bar")) =?> diff --git a/test/Tests/Writers/ConTeXt.hs b/test/Tests/Writers/ConTeXt.hs index cbcbe3b94..a5185e19f 100644 --- a/test/Tests/Writers/ConTeXt.hs +++ b/test/Tests/Writers/ConTeXt.hs @@ -1,7 +1,8 @@ {-# LANGUAGE OverloadedStrings #-} module Tests.Writers.ConTeXt (tests) where -import Test.Framework +import Test.Tasty +import Test.Tasty.QuickCheck import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -27,14 +28,14 @@ which is in turn shorthand for infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test context -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "inline code" [ "with '}'" =: code "}" =?> "\\mono{\\}}" , "without '}'" =: code "]" =?> "\\type{]}" - , property "code property" $ \s -> null s || + , testProperty "code property" $ \s -> null s || if '{' `elem` s || '}' `elem` s then (context' $ code s) == "\\mono{" ++ (context' $ str s) ++ "}" diff --git a/test/Tests/Writers/Docbook.hs b/test/Tests/Writers/Docbook.hs index 5b3270139..d7da51aed 100644 --- a/test/Tests/Writers/Docbook.hs +++ b/test/Tests/Writers/Docbook.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Tests.Writers.Docbook (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -27,7 +27,7 @@ which is in turn shorthand for infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test docbook lineblock :: Blocks @@ -40,7 +40,7 @@ lineblock_out = [ "<literallayout>some text" , "and again</literallayout>" ] -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "line blocks" [ "none" =: para "This is a test" =?> unlines diff --git a/test/Tests/Writers/Docx.hs b/test/Tests/Writers/Docx.hs index be32518bf..2d7179199 100644 --- a/test/Tests/Writers/Docx.hs +++ b/test/Tests/Writers/Docx.hs @@ -1,7 +1,7 @@ module Tests.Writers.Docx (tests) where import System.FilePath ((</>)) -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc.Class (runIOorExplode) import Text.Pandoc.Definition @@ -9,6 +9,7 @@ import Text.Pandoc.Options import Text.Pandoc.Readers.Docx import Text.Pandoc.Readers.Native import Text.Pandoc.Writers.Docx +import System.IO.Unsafe (unsafePerformIO) -- TODO temporary type Options = (WriterOptions, ReaderOptions) @@ -27,26 +28,26 @@ compareOutput opts nativeFileIn nativeFileOut = do p <- runIOorExplode $ readDocx (snd opts) df return (p, df') -testCompareWithOptsIO :: Options -> String -> FilePath -> FilePath -> IO Test +testCompareWithOptsIO :: Options -> String -> FilePath -> FilePath -> IO TestTree testCompareWithOptsIO opts name nativeFileIn nativeFileOut = do (dp, np) <- compareOutput opts nativeFileIn nativeFileOut return $ test id name (dp, np) -testCompareWithOpts :: Options -> String -> FilePath -> FilePath -> Test +testCompareWithOpts :: Options -> String -> FilePath -> FilePath -> TestTree testCompareWithOpts opts name nativeFileIn nativeFileOut = - buildTest $ testCompareWithOptsIO opts name nativeFileIn nativeFileOut + unsafePerformIO $ testCompareWithOptsIO opts name nativeFileIn nativeFileOut -roundTripCompareWithOpts :: Options -> String -> FilePath -> Test +roundTripCompareWithOpts :: Options -> String -> FilePath -> TestTree roundTripCompareWithOpts opts name nativeFile = testCompareWithOpts opts name nativeFile nativeFile --- testCompare :: String -> FilePath -> FilePath -> Test +-- testCompare :: String -> FilePath -> FilePath -> TestTree -- testCompare = testCompareWithOpts def -roundTripCompare :: String -> FilePath -> Test +roundTripCompare :: String -> FilePath -> TestTree roundTripCompare = roundTripCompareWithOpts def -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "inlines" [ roundTripCompare "font formatting" diff --git a/test/Tests/Writers/HTML.hs b/test/Tests/Writers/HTML.hs index 95450625c..4246b033d 100644 --- a/test/Tests/Writers/HTML.hs +++ b/test/Tests/Writers/HTML.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Tests.Writers.HTML (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -24,10 +24,10 @@ which is in turn shorthand for infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test html -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "inline code" [ "basic" =: code "@&" =?> "<code>@&</code>" , "haskell" =: codeWith ("",["haskell"],[]) ">>=" diff --git a/test/Tests/Writers/LaTeX.hs b/test/Tests/Writers/LaTeX.hs index fc4212aed..5f8aea3e0 100644 --- a/test/Tests/Writers/LaTeX.hs +++ b/test/Tests/Writers/LaTeX.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Tests.Writers.LaTeX (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -33,10 +33,10 @@ which is in turn shorthand for infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test latex -tests :: [Test] +tests :: [TestTree] 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/test/Tests/Writers/Markdown.hs b/test/Tests/Writers/Markdown.hs index 80ef45170..5b1e76a29 100644 --- a/test/Tests/Writers/Markdown.hs +++ b/test/Tests/Writers/Markdown.hs @@ -2,7 +2,7 @@ {-# OPTIONS_GHC -fno-warn-name-shadowing #-} module Tests.Writers.Markdown (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -31,10 +31,10 @@ which is in turn shorthand for infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test markdown -tests :: [Test] +tests :: [TestTree] tests = [ "indented code after list" =: (orderedList [ para "one" <> para "two" ] <> codeBlock "test") =?> "1. one\n\n two\n\n<!-- -->\n\n test" @@ -85,7 +85,7 @@ noteTestDoc = -noteTests :: Test +noteTests :: TestTree noteTests = testGroup "note and reference location" [ test (markdownWithOpts defopts) "footnotes at the end of a document" $ @@ -176,12 +176,12 @@ noteTests = testGroup "note and reference location" ] -shortcutLinkRefsTests :: Test +shortcutLinkRefsTests :: TestTree shortcutLinkRefsTests = let infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test (purely (writeMarkdown defopts{writerReferenceLinks = True}) . toPandoc) in testGroup "Shortcut reference links" [ "Simple link (shortcutable)" diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index 12ecfb477..9a7dec580 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -1,6 +1,6 @@ module Tests.Writers.Muse (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary() @@ -14,10 +14,10 @@ museWithOpts opts = purely (writeMuse opts) . toPandoc infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test muse -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "block elements" [ "plain" =: plain (text "Foo bar.") =?> "Foo bar." , testGroup "paragraphs" diff --git a/test/Tests/Writers/Native.hs b/test/Tests/Writers/Native.hs index 3a1d45fc4..14055d329 100644 --- a/test/Tests/Writers/Native.hs +++ b/test/Tests/Writers/Native.hs @@ -1,6 +1,7 @@ module Tests.Writers.Native (tests) where -import Test.Framework +import Test.Tasty +import Test.Tasty.QuickCheck import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -15,8 +16,8 @@ p_write_blocks_rt bs = read (purely (writeNative def) (Pandoc nullMeta bs)) == bs -tests :: [Test] -tests = [ property "p_write_rt" p_write_rt - , property "p_write_blocks_rt" $ mapSize +tests :: [TestTree] +tests = [ testProperty "p_write_rt" p_write_rt + , testProperty "p_write_blocks_rt" $ mapSize (\x -> if x > 3 then 3 else x) $ p_write_blocks_rt ] diff --git a/test/Tests/Writers/Org.hs b/test/Tests/Writers/Org.hs index 6943081d3..9cbe360da 100644 --- a/test/Tests/Writers/Org.hs +++ b/test/Tests/Writers/Org.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Tests.Writers.Org (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -9,10 +9,10 @@ import Text.Pandoc.Builder infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test (purely (writeOrg def . toPandoc)) -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "links" -- See http://orgmode.org/manual/Internal-links.html#Internal-links [ "simple link" diff --git a/test/Tests/Writers/Plain.hs b/test/Tests/Writers/Plain.hs index 854ed6b12..ab09bca26 100644 --- a/test/Tests/Writers/Plain.hs +++ b/test/Tests/Writers/Plain.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Tests.Writers.Plain (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -10,11 +10,11 @@ import Text.Pandoc.Builder infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test (purely (writePlain def) . toPandoc) -tests :: [Test] +tests :: [TestTree] tests = [ "strongly emphasized text to uppercase" =: strong "Straße" =?> "STRASSE" diff --git a/test/Tests/Writers/RST.hs b/test/Tests/Writers/RST.hs index 1b250f737..13944ed34 100644 --- a/test/Tests/Writers/RST.hs +++ b/test/Tests/Writers/RST.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Tests.Writers.RST (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -9,10 +9,10 @@ import Text.Pandoc.Builder infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test (purely (writeRST def . toPandoc)) -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "rubrics" [ "in list item" =: bulletList [header 2 (text "foo")] =?> diff --git a/test/Tests/Writers/TEI.hs b/test/Tests/Writers/TEI.hs index 713309784..f0a034bbd 100644 --- a/test/Tests/Writers/TEI.hs +++ b/test/Tests/Writers/TEI.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module Tests.Writers.TEI (tests) where -import Test.Framework +import Test.Tasty import Tests.Helpers import Text.Pandoc import Text.Pandoc.Arbitrary () @@ -21,10 +21,10 @@ which is in turn shorthand for infix 4 =: (=:) :: (ToString a, ToPandoc a) - => String -> (a, String) -> Test + => String -> (a, String) -> TestTree (=:) = test (purely (writeTEI def) . toPandoc) -tests :: [Test] +tests :: [TestTree] tests = [ testGroup "block elements" ["para" =: para "Lorem ipsum cetera." =?> "<p>Lorem ipsum cetera.</p>" |