diff options
Diffstat (limited to 'src/Tests/Old.hs')
-rw-r--r-- | src/Tests/Old.hs | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/Tests/Old.hs b/src/Tests/Old.hs index a26e435a0..3315bb74e 100644 --- a/src/Tests/Old.hs +++ b/src/Tests/Old.hs @@ -99,13 +99,27 @@ tests = [ testGroup "markdown" , test "reader" ["-r", "textile", "-w", "native", "-s"] "textile-reader.textile" "textile-reader.native" ] + , testGroup "docbook" + [ testGroup "writer" $ writerTests "docbook" + , test "reader" ["-r", "docbook", "-w", "native", "-s"] + "docbook-reader.docbook" "docbook-reader.native" + ] , testGroup "native" [ testGroup "writer" $ writerTests "native" , test "reader" ["-r", "native", "-w", "native", "-s"] "testsuite.native" "testsuite.native" ] + , testGroup "fb2" + [ fb2WriterTest "basic" [] "fb2.basic.markdown" "fb2.basic.fb2" + , fb2WriterTest "titles" [] "fb2.titles.markdown" "fb2.titles.fb2" + , fb2WriterTest "images" [] "fb2.images.markdown" "fb2.images.fb2" + , fb2WriterTest "images-embedded" [] "fb2.images-embedded.html" "fb2.images-embedded.fb2" + , fb2WriterTest "tables" [] "tables.native" "tables.fb2" + , fb2WriterTest "math" [] "fb2.math.markdown" "fb2.math.fb2" + , fb2WriterTest "testsuite" [] "testsuite.native" "writer.fb2" + ] , testGroup "other writers" $ map (\f -> testGroup f $ writerTests f) - [ "docbook", "opendocument" , "context" , "texinfo" + [ "opendocument" , "context" , "texinfo" , "man" , "plain" , "mediawiki", "rtf", "org", "asciidoc" ] ] @@ -139,14 +153,27 @@ writerTests format opts = ["-r", "native", "-w", format, "--columns=78"] s5WriterTest :: String -> [String] -> String -> Test -s5WriterTest modifier opts format +s5WriterTest modifier opts format = test (format ++ " writer (" ++ modifier ++ ")") - (["-r", "native", "-w", format] ++ opts) + (["-r", "native", "-w", format] ++ opts) "s5.native" ("s5." ++ modifier <.> "html") +fb2WriterTest :: String -> [String] -> String -> String -> Test +fb2WriterTest title opts inputfile normfile = + testWithNormalize (ignoreBinary . formatXML) + title (["-t", "fb2"]++opts) inputfile normfile + where + formatXML xml = splitTags $ zip xml (drop 1 xml) + splitTags [] = [] + splitTags [end] = fst end : snd end : [] + splitTags (('>','<'):rest) = ">\n" ++ splitTags rest + splitTags ((c,_):rest) = c : splitTags rest + ignoreBinary = unlines . filter (not . startsWith "<binary ") . lines + startsWith tag str = all (uncurry (==)) $ zip tag str + markdownCitationTests :: [Test] markdownCitationTests - = map styleToTest ["chicago-author-date","ieee","mhra"] + = map styleToTest ["chicago-author-date","ieee","mhra"] ++ [test "natbib" wopts "markdown-citations.txt" "markdown-citations.txt"] where |