aboutsummaryrefslogtreecommitdiff
path: root/haddock-library/test/Documentation/Haddock/ParserSpec.hs
diff options
context:
space:
mode:
authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-06-25 10:01:55 +0200
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-06-25 10:36:54 +0200
commit526067188c056a5d73e7e44671ca98baf12d666b (patch)
tree24af2bada672ab2f47938ab76dd3b51f6de3c833 /haddock-library/test/Documentation/Haddock/ParserSpec.hs
parent5412c262f403e52be45d607b34eb3a5806ea2a76 (diff)
Fix anchors. Closes #308.
Diffstat (limited to 'haddock-library/test/Documentation/Haddock/ParserSpec.hs')
-rw-r--r--haddock-library/test/Documentation/Haddock/ParserSpec.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/haddock-library/test/Documentation/Haddock/ParserSpec.hs b/haddock-library/test/Documentation/Haddock/ParserSpec.hs
index 8e73848d..4bcbbec7 100644
--- a/haddock-library/test/Documentation/Haddock/ParserSpec.hs
+++ b/haddock-library/test/Documentation/Haddock/ParserSpec.hs
@@ -169,6 +169,13 @@ spec = do
it "does not accept newlines in anchors" $ do
"#foo\nbar#" `shouldParseTo` "#foo\nbar#"
+ it "accepts anchors mid-paragraph" $ do
+ "Hello #someAnchor# world!"
+ `shouldParseTo` "Hello " <> DocAName "someAnchor" <> " world!"
+
+ it "does not accept empty anchors" $ do
+ "##" `shouldParseTo` "##"
+
context "when parsing emphasised text" $ do
it "emphasises a word on its own" $ do
"/foo/" `shouldParseTo` DocEmphasis "foo"
@@ -292,6 +299,12 @@ spec = do
it "treats empty module name as regular double quotes" $ do
"\"\"" `shouldParseTo` "\"\""
+ it "accepts anchor reference syntax as DocModule" $ do
+ "\"Foo#bar\"" `shouldParseTo` DocModule "Foo#bar"
+
+ it "accepts old anchor reference syntax as DocModule" $ do
+ "\"Foo\\#bar\"" `shouldParseTo` DocModule "Foo\\#bar"
+
describe "parseParas" $ do
let infix 1 `shouldParseTo`
shouldParseTo :: String -> Doc String -> Expectation