aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Readers
diff options
context:
space:
mode:
Diffstat (limited to 'test/Tests/Readers')
-rw-r--r--test/Tests/Readers/Creole.hs2
-rw-r--r--test/Tests/Readers/Docx.hs15
-rw-r--r--test/Tests/Readers/EPUB.hs2
-rw-r--r--test/Tests/Readers/Muse.hs113
-rw-r--r--test/Tests/Readers/Org/Block/Header.hs2
-rw-r--r--test/Tests/Readers/Org/Block/List.hs18
-rw-r--r--test/Tests/Readers/Org/Directive.hs4
-rw-r--r--test/Tests/Readers/Org/Inline.hs59
-rw-r--r--test/Tests/Readers/Org/Inline/Note.hs1
-rw-r--r--test/Tests/Readers/Org/Inline/Smart.hs4
-rw-r--r--test/Tests/Readers/Org/Meta.hs28
-rw-r--r--test/Tests/Readers/RST.hs29
-rw-r--r--test/Tests/Readers/Txt2Tags.hs8
13 files changed, 167 insertions, 118 deletions
diff --git a/test/Tests/Readers/Creole.hs b/test/Tests/Readers/Creole.hs
index 3a21df738..3f60a523d 100644
--- a/test/Tests/Readers/Creole.hs
+++ b/test/Tests/Readers/Creole.hs
@@ -224,7 +224,7 @@ tests = [
<> " bar")
, "escaped auto link" =:
"foo ~http://foo.example.com/bar/baz.html bar"
- =?> para ("foo http://foo.example.com/bar/baz.html bar")
+ =?> para "foo http://foo.example.com/bar/baz.html bar"
, "wiki link simple" =:
"foo [[http://foo.example.com/foo.png]] bar"
=?> para ("foo "
diff --git a/test/Tests/Readers/Docx.hs b/test/Tests/Readers/Docx.hs
index 68c2e3476..89a605bf7 100644
--- a/test/Tests/Readers/Docx.hs
+++ b/test/Tests/Readers/Docx.hs
@@ -5,6 +5,7 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as B
import qualified Data.Map as M
import qualified Data.Text as T
+import Data.Maybe
import System.IO.Unsafe
import Test.Tasty
import Test.Tasty.HUnit
@@ -46,7 +47,7 @@ compareOutput opts docxFile nativeFile = do
nf <- UTF8.toText <$> BS.readFile nativeFile
p <- runIOorExplode $ readDocx opts df
df' <- runIOorExplode $ readNative def nf
- return $ (noNorm p, noNorm df')
+ return (noNorm p, noNorm df')
testCompareWithOptsIO :: ReaderOptions -> String -> FilePath -> FilePath -> IO TestTree
testCompareWithOptsIO opts name docxFile nativeFile = do
@@ -87,11 +88,9 @@ compareMediaPathIO mediaPath mediaBag docxPath = do
Nothing -> error ("couldn't find " ++
mediaPath ++
" in media bag")
- docxBS = case docxMedia of
- Just bs -> bs
- Nothing -> error ("couldn't find " ++
- mediaPath ++
- " in media bag")
+ docxBS = fromMaybe (error ("couldn't find " ++
+ mediaPath ++
+ " in media bag")) docxMedia
return $ mbBS == docxBS
compareMediaBagIO :: FilePath -> IO Bool
@@ -128,6 +127,10 @@ tests = [ testGroup "inlines"
"docx/links.docx"
"docx/links.native"
, testCompare
+ "hyperlinks in <w:instrText> tag"
+ "docx/instrText_hyperlink.docx"
+ "docx/instrText_hyperlink.native"
+ , testCompare
"inline image"
"docx/image.docx"
"docx/image_no_embed.native"
diff --git a/test/Tests/Readers/EPUB.hs b/test/Tests/Readers/EPUB.hs
index 201fd10a5..1337a9c11 100644
--- a/test/Tests/Readers/EPUB.hs
+++ b/test/Tests/Readers/EPUB.hs
@@ -17,7 +17,7 @@ getMediaBag fp = do
testMediaBag :: FilePath -> [(String, String, Int)] -> IO ()
testMediaBag fp bag = do
- actBag <- (mediaDirectory <$> getMediaBag fp)
+ actBag <- mediaDirectory <$> getMediaBag fp
assertBool (show "MediaBag did not match:\nExpected: "
++ show bag
++ "\nActual: "
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index e9ac64a96..36b08c3a2 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -27,15 +27,20 @@ infix 4 =:
spcSep :: [Inlines] -> Inlines
spcSep = mconcat . intersperse space
--- Tables and definition lists don't round-trip yet
+-- Tables don't round-trip yet
+-- Definition lists with multiple descriptions are supported by writer, but not reader yet
+
+singleDescription :: ([Inline], [[Block]]) -> ([Inline], [[Block]])
+singleDescription (a, x:_) = (a, [x])
+singleDescription x = x
makeRoundTrip :: Block -> Block
-makeRoundTrip (Table{}) = Para [Str "table was here"]
-makeRoundTrip (DefinitionList{}) = Para [Str "deflist was here"]
+makeRoundTrip Table{} = Para [Str "table was here"]
+makeRoundTrip (DefinitionList items) = DefinitionList $ map singleDescription items
makeRoundTrip x = x
-- Demand that any AST produced by Muse reader and written by Muse writer can be read back exactly the same way.
--- Currently we remove code blocks and tables and compare third rewrite to the second.
+-- Currently we remove tables and compare third rewrite to the second.
-- First and second rewrites are not equal yet.
roundTrip :: Block -> Bool
roundTrip b = d'' == d'''
@@ -44,7 +49,7 @@ roundTrip b = d'' == d'''
d'' = rewrite d'
d''' = rewrite d''
rewrite = amuse . T.pack . (++ "\n") . T.unpack .
- (purely $ writeMuse def { writerExtensions = extensionsFromList [Ext_amuse]
+ purely (writeMuse def { writerExtensions = extensionsFromList [Ext_amuse]
, writerWrapText = WrapPreserve
})
@@ -114,8 +119,8 @@ tests =
, "Linebreak" =: "Line <br> break" =?> para ("Line" <> linebreak <> "break")
- , test emacsMuse "Non-breaking space"
- ("Foo~~bar" =?> para "Foo\160bar")
+ , "Non-breaking space" =: "Foo~~bar" =?> para "Foo\160bar"
+ , "Single ~" =: "Foo~bar" =?> para "Foo~bar"
, testGroup "Code markup"
[ "Code" =: "=foo(bar)=" =?> para (code "foo(bar)")
@@ -153,6 +158,9 @@ tests =
] =?>
para "foo =bar" <>
para "baz= foo"
+
+ , "Code at the beginning of paragraph but not first column" =:
+ " - =foo=" =?> bulletList [ para $ code "foo" ]
]
, "Code tag" =: "<code>foo(bar)</code>" =?> para (code "foo(bar)")
@@ -161,6 +169,8 @@ tests =
, "Verbatim inside code" =: "<code><verbatim>foo</verbatim></code>" =?> para (code "<verbatim>foo</verbatim>")
+ , "Verbatim tag after text" =: "Foo <verbatim>bar</verbatim>" =?> para "Foo bar"
+
, testGroup "Links"
[ "Link without description" =:
"[[https://amusewiki.org/]]" =?>
@@ -279,20 +289,12 @@ tests =
, " One two three"
, ""
, "</verse>"
- , "<verse>Foo bar</verse>"
- , "<verse>"
- , "Foo bar</verse>"
- , "<verse>"
- , " Foo</verse>"
] =?>
lineBlock [ ""
, text "Foo bar baz"
, text "\160\160One two three"
, ""
- ] <>
- lineBlock [ "Foo bar" ] <>
- lineBlock [ "Foo bar" ] <>
- lineBlock [ "\160\160\160Foo" ]
+ ]
, testGroup "Example"
[ "Braces on separate lines" =:
T.unlines [ "{{{"
@@ -356,6 +358,11 @@ tests =
, " </example>"
] =?>
bulletList [ codeBlock "foo" ]
+ , "Empty example inside list" =:
+ T.unlines [ " - <example>"
+ , " </example>"
+ ] =?>
+ bulletList [ codeBlock "" ]
, "Example inside list with empty lines" =:
T.unlines [ " - <example>"
, " foo"
@@ -537,12 +544,14 @@ tests =
, "[1] First footnote paragraph"
, ""
, " Second footnote paragraph"
+ , "with continuation"
+ , ""
, "Not a note"
, "[2] Second footnote"
] =?>
para (text "Multiparagraph" <>
note (para "First footnote paragraph" <>
- para "Second footnote paragraph") <>
+ para "Second footnote paragraph\nwith continuation") <>
text " footnotes" <>
note (para "Second footnote")) <>
para (text "Not a note")
@@ -713,8 +722,48 @@ tests =
, mempty
, para "Item3"
]
+ , "Bullet list with last item empty" =:
+ T.unlines
+ [ " -"
+ , ""
+ , "foo"
+ ] =?>
+ bulletList [ mempty ] <>
+ para "foo"
, testGroup "Nested lists"
- [ "Nested list" =:
+ [ "Nested bullet list" =:
+ T.unlines [ " - Item1"
+ , " - Item2"
+ , " - Item3"
+ , " - Item4"
+ , " - Item5"
+ , " - Item6"
+ ] =?>
+ bulletList [ para "Item1" <>
+ bulletList [ para "Item2" <>
+ bulletList [ para "Item3" ]
+ , para "Item4" <>
+ bulletList [ para "Item5" ]
+ ]
+ , para "Item6"
+ ]
+ , "Nested ordered list" =:
+ T.unlines [ " 1. Item1"
+ , " 1. Item2"
+ , " 1. Item3"
+ , " 2. Item4"
+ , " 1. Item5"
+ , " 2. Item6"
+ ] =?>
+ orderedListWith (1, Decimal, Period) [ para "Item1" <>
+ orderedListWith (1, Decimal, Period) [ para "Item2" <>
+ orderedListWith (1, Decimal, Period) [ para "Item3" ]
+ , para "Item4" <>
+ orderedListWith (1, Decimal, Period) [ para "Item5" ]
+ ]
+ , para "Item6"
+ ]
+ , "Mixed nested list" =:
T.unlines
[ " - Item1"
, " - Item2"
@@ -736,12 +785,6 @@ tests =
]
]
]
- , "Incorrectly indented Text::Amuse nested list" =:
- T.unlines
- [ " - First item"
- , " - Not nested item"
- ] =?>
- bulletList [ para "First item", para "Not nested item"]
, "Text::Amuse includes only one space in list marker" =:
T.unlines
[ " - First item"
@@ -886,6 +929,8 @@ tests =
definitionList [ ("foo", [ para "bar" ]) ]
, "Definition list term with emphasis" =: " *Foo* :: bar\n" =?>
definitionList [ (emph "Foo", [ para "bar" ]) ]
+ , "Definition list term with :: inside code" =: " foo <code> :: </code> :: bar <code> :: </code> baz\n" =?>
+ definitionList [ ("foo " <> code " :: ", [ para $ "bar " <> code " :: " <> " baz" ]) ]
, "Multi-line definition lists" =:
T.unlines
[ " First term :: Definition of first term"
@@ -920,16 +965,18 @@ tests =
definitionList [ ("Term1", [ para "This is a first definition\nAnd it has two lines;\nno, make that three."])
, ("Term2", [ para "This is a second definition"])
])
- -- Emacs Muse creates two separate lists when indentation of items is different.
- -- We follow Amusewiki and allow different indentation within one list.
- , "Changing indentation" =:
+ , "One-line nested definition list" =:
+ " Foo :: bar :: baz" =?>
+ definitionList [ ("Foo", [ definitionList [ ("bar", [ para "baz" ])]])]
+ , "Nested definition list" =:
T.unlines
- [ " First term :: Definition of first term"
- , "and its continuation."
- , " Second term :: Definition of second term."
- ] =?>
- definitionList [ ("First term", [ para "Definition of first term\nand its continuation." ])
- , ("Second term", [ para "Definition of second term." ])
+ [ " First :: Second :: Third"
+ , " Fourth :: Fifth :: Sixth"
+ , " Seventh :: Eighth"
+ ] =?>
+ definitionList [ ("First", [ definitionList [ ("Second", [ para "Third" ]),
+ ("Fourth", [ definitionList [ ("Fifth", [ para "Sixth"] ) ] ] ) ] ] )
+ , ("Seventh", [ para "Eighth" ])
]
, "Two blank lines separate definition lists" =:
T.unlines
diff --git a/test/Tests/Readers/Org/Block/Header.hs b/test/Tests/Readers/Org/Block/Header.hs
index d895c86e2..e8ad88558 100644
--- a/test/Tests/Readers/Org/Block/Header.hs
+++ b/test/Tests/Readers/Org/Block/Header.hs
@@ -130,7 +130,7 @@ tests =
mconcat [ para "foo"
, headerWith ("thing-other-thing", [], [])
1
- ((strikeout "thing") <> " other thing")
+ (strikeout "thing" <> " other thing")
]
, "Comment Trees" =:
diff --git a/test/Tests/Readers/Org/Block/List.hs b/test/Tests/Readers/Org/Block/List.hs
index 32bb13294..343682a80 100644
--- a/test/Tests/Readers/Org/Block/List.hs
+++ b/test/Tests/Readers/Org/Block/List.hs
@@ -75,16 +75,16 @@ tests =
]
, "Bullet List with Decreasing Indent" =:
- (" - Discovery\n\
- \ - Human After All\n") =?>
+ " - Discovery\n\
+ \ - Human After All\n" =?>
mconcat [ bulletList [ plain "Discovery" ]
, bulletList [ plain ("Human" <> space <> "After" <> space <> "All")]
]
, "Header follows Bullet List" =:
- (" - Discovery\n\
+ " - Discovery\n\
\ - Human After All\n\
- \* Homework") =?>
+ \* Homework" =?>
mconcat [ bulletList [ plain "Discovery"
, plain ("Human" <> space <> "After" <> space <> "All")
]
@@ -92,9 +92,9 @@ tests =
]
, "Bullet List Unindented with trailing Header" =:
- ("- Discovery\n\
+ "- Discovery\n\
\- Homework\n\
- \* NotValidListItem") =?>
+ \* NotValidListItem" =?>
mconcat [ bulletList [ plain "Discovery"
, plain "Homework"
]
@@ -166,14 +166,14 @@ tests =
, "Ordered List in Bullet List" =:
("- Emacs\n" <>
" 1. Org\n") =?>
- bulletList [ (plain "Emacs") <>
- (orderedList [ plain "Org"])
+ bulletList [ plain "Emacs" <>
+ orderedList [ plain "Org"]
]
, "Bullet List in Ordered List" =:
("1. GNU\n" <>
" - Freedom\n") =?>
- orderedList [ (plain "GNU") <> bulletList [ (plain "Freedom") ] ]
+ orderedList [ plain "GNU" <> bulletList [ plain "Freedom" ] ]
, "Definition List" =:
T.unlines [ "- PLL :: phase-locked loop"
diff --git a/test/Tests/Readers/Org/Directive.hs b/test/Tests/Readers/Org/Directive.hs
index 862315ef3..7e2c0fb8d 100644
--- a/test/Tests/Readers/Org/Directive.hs
+++ b/test/Tests/Readers/Org/Directive.hs
@@ -107,8 +107,8 @@ tests =
] =?>
mconcat [ para "first block"
, orderedList
- [ (para "top-level section 1" <>
- orderedList [ para "subsection" ])
+ [ para "top-level section 1" <>
+ orderedList [ para "subsection" ]
, para "top-level section 2" ]
]
diff --git a/test/Tests/Readers/Org/Inline.hs b/test/Tests/Readers/Org/Inline.hs
index cb50ba630..da0d1db0b 100644
--- a/test/Tests/Readers/Org/Inline.hs
+++ b/test/Tests/Readers/Org/Inline.hs
@@ -36,7 +36,7 @@ tests =
, "Underline" =:
"_underline_" =?>
- para (underlineSpan $ "underline")
+ para (underlineSpan "underline")
, "Strikeout" =:
"+Kill Bill+" =?>
@@ -127,11 +127,12 @@ tests =
, "Markup should work properly after a blank line" =:
T.unlines ["foo", "", "/bar/"] =?>
- (para $ text "foo") <> (para $ emph $ text "bar")
+ para (text "foo") <>
+ para (emph $ text "bar")
, "Inline math must stay within three lines" =:
T.unlines [ "$a", "b", "c$", "$d", "e", "f", "g$" ] =?>
- para ((math "a\nb\nc") <> softbreak <>
+ para (math "a\nb\nc" <> softbreak <>
"$d" <> softbreak <> "e" <> softbreak <>
"f" <> softbreak <> "g$")
@@ -139,7 +140,7 @@ tests =
"$a$ $b$! $c$?" =?>
para (spcSep [ math "a"
, "$b$!"
- , (math "c") <> "?"
+ , math "c" <> "?"
])
, "Markup may not span more than two lines" =:
@@ -166,12 +167,12 @@ tests =
para (mconcat $ intersperse softbreak
[ "a" <> subscript "(a(b)(c)d)"
, "e" <> superscript "(f(g)h)"
- , "i" <> (subscript "(jk)") <> "l)"
- , "m" <> (superscript "()") <> "n"
+ , "i" <> subscript "(jk)" <> "l)"
+ , "m" <> superscript "()" <> "n"
, "o" <> subscript "p{q{}r}"
, "s" <> superscript "t{u}v"
- , "w" <> (subscript "xy") <> "z}"
- , "1" <> (superscript "") <> "2"
+ , "w" <> subscript "xy" <> "z}"
+ , "1" <> superscript "" <> "2"
, "3" <> subscript "{}"
, "4" <> superscript ("(a(" <> strong "b(c" <> ")d))")
])
@@ -182,17 +183,17 @@ tests =
, testGroup "Images"
[ "Image" =:
"[[./sunset.jpg]]" =?>
- (para $ image "./sunset.jpg" "" "")
+ para (image "./sunset.jpg" "" "")
, "Image with explicit file: prefix" =:
"[[file:sunrise.jpg]]" =?>
- (para $ image "sunrise.jpg" "" "")
+ para (image "sunrise.jpg" "" "")
, "Multiple images within a paragraph" =:
T.unlines [ "[[file:sunrise.jpg]]"
, "[[file:sunset.jpg]]"
] =?>
- (para $ (image "sunrise.jpg" "" "")
+ para ((image "sunrise.jpg" "" "")
<> softbreak
<> (image "sunset.jpg" "" ""))
@@ -200,75 +201,75 @@ tests =
T.unlines [ "#+ATTR_HTML: :width 50%"
, "[[file:guinea-pig.gif]]"
] =?>
- (para $ imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")
+ para (imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")
]
, "Explicit link" =:
"[[http://zeitlens.com/][pseudo-random /nonsense/]]" =?>
- (para $ link "http://zeitlens.com/" ""
+ para (link "http://zeitlens.com/" ""
("pseudo-random" <> space <> emph "nonsense"))
, "Self-link" =:
"[[http://zeitlens.com/]]" =?>
- (para $ link "http://zeitlens.com/" "" "http://zeitlens.com/")
+ para (link "http://zeitlens.com/" "" "http://zeitlens.com/")
, "Absolute file link" =:
"[[/url][hi]]" =?>
- (para $ link "file:///url" "" "hi")
+ para (link "file:///url" "" "hi")
, "Link to file in parent directory" =:
"[[../file.txt][moin]]" =?>
- (para $ link "../file.txt" "" "moin")
+ para (link "../file.txt" "" "moin")
, "Empty link (for gitit interop)" =:
"[[][New Link]]" =?>
- (para $ link "" "" "New Link")
+ para (link "" "" "New Link")
, "Image link" =:
"[[sunset.png][file:dusk.svg]]" =?>
- (para $ link "sunset.png" "" (image "dusk.svg" "" ""))
+ para (link "sunset.png" "" (image "dusk.svg" "" ""))
, "Image link with non-image target" =:
"[[http://example.com][./logo.png]]" =?>
- (para $ link "http://example.com" "" (image "./logo.png" "" ""))
+ para (link "http://example.com" "" (image "./logo.png" "" ""))
, "Plain link" =:
"Posts on http://zeitlens.com/ can be funny at times." =?>
- (para $ spcSep [ "Posts", "on"
+ para (spcSep [ "Posts", "on"
, link "http://zeitlens.com/" "" "http://zeitlens.com/"
, "can", "be", "funny", "at", "times."
])
, "Angle link" =:
"Look at <http://moltkeplatz.de> for fnords." =?>
- (para $ spcSep [ "Look", "at"
+ para (spcSep [ "Look", "at"
, link "http://moltkeplatz.de" "" "http://moltkeplatz.de"
, "for", "fnords."
])
, "Absolute file link" =:
"[[file:///etc/passwd][passwd]]" =?>
- (para $ link "file:///etc/passwd" "" "passwd")
+ para (link "file:///etc/passwd" "" "passwd")
, "File link" =:
"[[file:target][title]]" =?>
- (para $ link "target" "" "title")
+ para (link "target" "" "title")
, "Anchor" =:
"<<anchor>> Link here later." =?>
- (para $ spanWith ("anchor", [], []) mempty <>
+ para (spanWith ("anchor", [], []) mempty <>
"Link" <> space <> "here" <> space <> "later.")
, "Inline code block" =:
"src_emacs-lisp{(message \"Hello\")}" =?>
- (para $ codeWith ( ""
+ para (codeWith ( ""
, [ "commonlisp" ]
, [ ("org-language", "emacs-lisp") ])
"(message \"Hello\")")
, "Inline code block with arguments" =:
"src_sh[:export both :results output]{echo 'Hello, World'}" =?>
- (para $ codeWith ( ""
+ para (codeWith ( ""
, [ "bash" ]
, [ ("org-language", "sh")
, ("export", "both")
@@ -279,7 +280,7 @@ tests =
, "Inline code block with toggle" =:
"src_sh[:toggle]{echo $HOME}" =?>
- (para $ codeWith ( ""
+ para (codeWith ( ""
, [ "bash" ]
, [ ("org-language", "sh")
, ("toggle", "yes")
@@ -415,7 +416,7 @@ tests =
in [
"Berkeley-style in-text citation" =:
"See @Dominik201408." =?>
- (para $ "See "
+ para ("See "
<> cite [dominikInText] "@Dominik201408"
<> ".")
@@ -468,7 +469,7 @@ tests =
, "MathML symbol in LaTeX-style" =:
"There is a hackerspace in Lübeck, Germany, called nbsp (unicode symbol: '\\nbsp')." =?>
- para ("There is a hackerspace in Lübeck, Germany, called nbsp (unicode symbol: ' ').")
+ para "There is a hackerspace in Lübeck, Germany, called nbsp (unicode symbol: ' ')."
, "MathML symbol in LaTeX-style, including braces" =:
"\\Aacute{}stor" =?>
diff --git a/test/Tests/Readers/Org/Inline/Note.hs b/test/Tests/Readers/Org/Inline/Note.hs
index 46416d7d8..9eb1d02d6 100644
--- a/test/Tests/Readers/Org/Inline/Note.hs
+++ b/test/Tests/Readers/Org/Inline/Note.hs
@@ -84,4 +84,3 @@ tests =
, para "next"
]
]
-
diff --git a/test/Tests/Readers/Org/Inline/Smart.hs b/test/Tests/Readers/Org/Inline/Smart.hs
index 7a5e653cf..77f10699d 100644
--- a/test/Tests/Readers/Org/Inline/Smart.hs
+++ b/test/Tests/Readers/Org/Inline/Smart.hs
@@ -38,9 +38,9 @@ tests =
, test orgSmart "Single quotes can be followed by emphasized text"
("Singles on the '/meat market/'" =?>
- para ("Singles on the " <> (singleQuoted $ emph "meat market")))
+ para ("Singles on the " <> singleQuoted (emph "meat market")))
, test orgSmart "Double quotes can be followed by emphasized text"
("Double income, no kids: \"/DINK/\"" =?>
- para ("Double income, no kids: " <> (doubleQuoted $ emph "DINK")))
+ para ("Double income, no kids: " <> doubleQuoted (emph "DINK")))
]
diff --git a/test/Tests/Readers/Org/Meta.hs b/test/Tests/Readers/Org/Meta.hs
index 3ad6f5d8b..409cd00ae 100644
--- a/test/Tests/Readers/Org/Meta.hs
+++ b/test/Tests/Readers/Org/Meta.hs
@@ -30,32 +30,32 @@ tests =
, "Title" =:
"#+TITLE: Hello, World" =?>
let titleInline = toList $ "Hello," <> space <> "World"
- meta = setMeta "title" (MetaInlines titleInline) $ nullMeta
+ meta = setMeta "title" (MetaInlines titleInline) nullMeta
in Pandoc meta mempty
, "Author" =:
"#+author: John /Emacs-Fanboy/ Doe" =?>
let author = toList . spcSep $ [ "John", emph "Emacs-Fanboy", "Doe" ]
- meta = setMeta "author" (MetaList [MetaInlines author]) $ nullMeta
+ meta = setMeta "author" (MetaList [MetaInlines author]) nullMeta
in Pandoc meta mempty
, "Multiple authors" =:
"#+author: James Dewey Watson, Francis Harry Compton Crick " =?>
let watson = MetaInlines $ toList "James Dewey Watson"
crick = MetaInlines $ toList "Francis Harry Compton Crick"
- meta = setMeta "author" (MetaList [watson, crick]) $ nullMeta
+ meta = setMeta "author" (MetaList [watson, crick]) nullMeta
in Pandoc meta mempty
, "Date" =:
"#+Date: Feb. *28*, 2014" =?>
- let date = toList . spcSep $ [ "Feb.", (strong "28") <> ",", "2014" ]
- meta = setMeta "date" (MetaInlines date) $ nullMeta
+ let date = toList . spcSep $ [ "Feb.", strong "28" <> ",", "2014" ]
+ meta = setMeta "date" (MetaInlines date) nullMeta
in Pandoc meta mempty
, "Description" =:
"#+DESCRIPTION: Explanatory text" =?>
let description = "Explanatory text"
- meta = setMeta "description" (MetaString description) $ nullMeta
+ meta = setMeta "description" (MetaString description) nullMeta
in Pandoc meta mempty
, "Properties drawer" =:
@@ -94,7 +94,7 @@ tests =
, "#+author: Max"
] =?>
let author = MetaInlines [Str "Max"]
- meta = setMeta "author" (MetaList [author]) $ nullMeta
+ meta = setMeta "author" (MetaList [author]) nullMeta
in Pandoc meta mempty
, "Logbook drawer" =:
@@ -135,7 +135,7 @@ tests =
, "Search links are read as emph" =:
"[[Wally][Where's Wally?]]" =?>
- (para (emph $ "Where's" <> space <> "Wally?"))
+ para (emph $ "Where's" <> space <> "Wally?")
, "Link to nonexistent anchor" =:
T.unlines [ "<<link-here>> Target."
@@ -149,25 +149,25 @@ tests =
T.unlines [ "#+LINK: wp https://en.wikipedia.org/wiki/%s"
, "[[wp:Org_mode][Wikipedia on Org-mode]]"
] =?>
- (para (link "https://en.wikipedia.org/wiki/Org_mode" ""
- ("Wikipedia" <> space <> "on" <> space <> "Org-mode")))
+ para (link "https://en.wikipedia.org/wiki/Org_mode" ""
+ ("Wikipedia" <> space <> "on" <> space <> "Org-mode"))
, "Link abbreviation, defined after first use" =:
T.unlines [ "[[zl:non-sense][Non-sense articles]]"
, "#+LINK: zl http://zeitlens.com/tags/%s.html"
] =?>
- (para (link "http://zeitlens.com/tags/non-sense.html" ""
- ("Non-sense" <> space <> "articles")))
+ para (link "http://zeitlens.com/tags/non-sense.html" ""
+ ("Non-sense" <> space <> "articles"))
, "Link abbreviation, URL encoded arguments" =:
T.unlines [ "#+link: expl http://example.com/%h/foo"
, "[[expl:Hello, World!][Moin!]]"
] =?>
- (para (link "http://example.com/Hello%2C%20World%21/foo" "" "Moin!"))
+ para (link "http://example.com/Hello%2C%20World%21/foo" "" "Moin!")
, "Link abbreviation, append arguments" =:
T.unlines [ "#+link: expl http://example.com/"
, "[[expl:foo][bar]]"
] =?>
- (para (link "http://example.com/foo" "" "bar"))
+ para (link "http://example.com/foo" "" "bar")
]
diff --git a/test/Tests/Readers/RST.hs b/test/Tests/Readers/RST.hs
index 928fc1a99..3753fbf12 100644
--- a/test/Tests/Readers/RST.hs
+++ b/test/Tests/Readers/RST.hs
@@ -36,8 +36,8 @@ tests = [ "line block with blank line" =:
, ":Parameter i: integer"
, ":Final: item"
, " on two lines" ]
- =?> ( doc
- $ para "para" <>
+ =?>
+ doc (para "para" <>
definitionList [ (str "Hostname", [para "media08"])
, (text "IP address", [para "10.0.0.19"])
, (str "Size", [para "3ru"])
@@ -56,10 +56,10 @@ tests = [ "line block with blank line" =:
, ""
, ":Version: 1"
]
- =?> ( setMeta "version" (para "1")
- $ setMeta "title" ("Title" :: Inlines)
+ =?>
+ setMeta "version" (para "1") (setMeta "title" ("Title" :: Inlines)
$ setMeta "subtitle" ("Subtitle" :: Inlines)
- $ doc mempty )
+ $ doc mempty)
, "with inline markup" =: T.unlines
[ ":*Date*: today"
, ""
@@ -73,8 +73,8 @@ tests = [ "line block with blank line" =:
, ".. _two: http://example.com"
, ".. _three: http://example.org"
]
- =?> ( setMeta "date" (str "today")
- $ doc
+ =?>
+ setMeta "date" (str "today") (doc
$ definitionList [ (emph "one", [para "emphasis"])
, (link "http://example.com" "" "two", [para "reference"])
, (link "http://example.org" "" "three", [para "another one"])
@@ -102,13 +102,12 @@ tests = [ "line block with blank line" =:
, " def func(x):"
, " return y"
] =?>
- ( doc $ codeBlockWith
+ doc (codeBlockWith
( ""
, ["sourceCode", "python", "numberLines", "class1", "class2", "class3"]
, [ ("startFrom", "34") ]
)
- "def func(x):\n return y"
- )
+ "def func(x):\n return y")
, "Code directive with number-lines, no line specified" =: T.unlines
[ ".. code::python"
, " :number-lines: "
@@ -116,13 +115,12 @@ tests = [ "line block with blank line" =:
, " def func(x):"
, " return y"
] =?>
- ( doc $ codeBlockWith
+ doc (codeBlockWith
( ""
, ["sourceCode", "python", "numberLines"]
, [ ("startFrom", "") ]
)
- "def func(x):\n return y"
- )
+ "def func(x):\n return y")
, testGroup "literal / line / code blocks"
[ "indented literal block" =: T.unlines
[ "::"
@@ -131,7 +129,8 @@ tests = [ "line block with blank line" =:
, ""
, " can go on for many lines"
, "but must stop here"]
- =?> (doc $
+ =?>
+ doc (
codeBlock "block quotes\n\ncan go on for many lines" <>
para "but must stop here")
, "line block with 3 lines" =: "| a\n| b\n| c"
@@ -185,6 +184,6 @@ tests = [ "line block with blank line" =:
, ".. [1]"
, " bar"
] =?>
- (para $ "foo" <> (note $ para "bar"))
+ para ("foo" <> (note $ para "bar"))
]
]
diff --git a/test/Tests/Readers/Txt2Tags.hs b/test/Tests/Readers/Txt2Tags.hs
index 28f647de4..9c5053af7 100644
--- a/test/Tests/Readers/Txt2Tags.hs
+++ b/test/Tests/Readers/Txt2Tags.hs
@@ -30,11 +30,11 @@ simpleTable' :: Int
-> [Blocks]
-> [[Blocks]]
-> Blocks
-simpleTable' n = table "" (take n $ repeat (AlignCenter, 0.0))
+simpleTable' n = table "" (replicate n (AlignCenter, 0.0))
tests :: [TestTree]
tests =
- [ testGroup "Inlines" $
+ [ testGroup "Inlines"
[ "Plain String" =:
"Hello, World" =?>
para (spcSep [ "Hello,", "World" ])
@@ -114,7 +114,7 @@ tests =
]
- , testGroup "Basic Blocks" $
+ , testGroup "Basic Blocks"
["Paragraph, lines grouped together" =:
"A paragraph\n A blank line ends the \n current paragraph\n"
=?> para "A paragraph\n A blank line ends the\n current paragraph"
@@ -197,7 +197,7 @@ tests =
]
- , testGroup "Lists" $
+ , testGroup "Lists"
[ "Simple Bullet Lists" =:
("- Item1\n" <>
"- Item2\n") =?>