aboutsummaryrefslogtreecommitdiff
path: root/test/Haddock/ParserSpec.hs
diff options
context:
space:
mode:
authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-03-31 18:29:04 +0100
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-03-31 18:29:04 +0100
commitd6cf6f9c75e08ce1760c2dbdee81775ba97a5f0c (patch)
tree7aa0b8788c1b093a154eb53a1a5fde191a27f3af /test/Haddock/ParserSpec.hs
parent8c64228d1b5d63714697a3df1a89e0d6dfc9b095 (diff)
Drop leading whitespace in @-style blocks.
Fixes #201.
Diffstat (limited to 'test/Haddock/ParserSpec.hs')
-rw-r--r--test/Haddock/ParserSpec.hs28
1 files changed, 25 insertions, 3 deletions
diff --git a/test/Haddock/ParserSpec.hs b/test/Haddock/ParserSpec.hs
index db843ccf..f44b7d0f 100644
--- a/test/Haddock/ParserSpec.hs
+++ b/test/Haddock/ParserSpec.hs
@@ -432,12 +432,34 @@ spec = before initStaticOpts $ do
] `shouldParseTo` DocCodeBlock "foo\n@\nbar\n"
it "accepts horizontal space before the @" $ do
+ unlines [ " @"
+ , "foo"
+ , ""
+ , "bar"
+ , "@"
+ ] `shouldParseTo` DocCodeBlock "foo\n\nbar\n"
+
+ it "strips a leading space from a @ block if present" $ do
+ unlines [ " @"
+ , " hello"
+ , " world"
+ , " @"
+ ] `shouldParseTo` DocCodeBlock "hello\nworld\n"
+
unlines [ " @"
- , " foo"
+ , " hello"
, ""
- , " bar"
+ , " world"
, " @"
- ] `shouldParseTo` DocCodeBlock " foo\n\n bar\n "
+ ] `shouldParseTo` DocCodeBlock "hello\n\nworld\n"
+
+ it "only drops whitespace if there's some before closing @" $ do
+ unlines [ "@"
+ , " Formatting"
+ , " matters."
+ , "@"
+ ]
+ `shouldParseTo` DocCodeBlock " Formatting\n matters.\n"
it "accepts unicode" $ do
"@foo 灼眼のシャナ bar@" `shouldParseTo` DocCodeBlock "foo 灼眼のシャナ bar"