aboutsummaryrefslogtreecommitdiff
path: root/tests/unit-tests/parsetests.hs
diff options
context:
space:
mode:
authorSimon Hengel <sol@typeful.net>2012-04-11 07:54:33 +0200
committerSimon Hengel <sol@typeful.net>2012-05-27 08:48:24 +0200
commitb8dcf173c272ebf85bbf2b427f84522e1474d092 (patch)
tree2e23551bf977b7a871c02c977eb9fecffc6233a2 /tests/unit-tests/parsetests.hs
parentb19a4bea999c684e092e0ea0feaf02ff8747d2a5 (diff)
Add support for hyperlink labels to parser
Diffstat (limited to 'tests/unit-tests/parsetests.hs')
-rw-r--r--tests/unit-tests/parsetests.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit-tests/parsetests.hs b/tests/unit-tests/parsetests.hs
index 7180a79e..0192ebfc 100644
--- a/tests/unit-tests/parsetests.hs
+++ b/tests/unit-tests/parsetests.hs
@@ -9,6 +9,7 @@ import Haddock.Lex (tokenise)
import Haddock.Parse (parseParas)
import Haddock.Types
import Outputable
+import Data.Monoid
instance Outputable a => Show a where
show = showSDoc . ppr
@@ -53,8 +54,21 @@ tests = [
input = ">>> putFooBar\nfoo\n<BLANKLINE>\nbar"
, result = Just $ DocExamples $ [Example "putFooBar" ["foo","","bar"]]
}
+
+ -- tests for links
+ , ParseTest {
+ input = "<http://example.com/>"
+ , result = Just . DocParagraph $ hyperlink "http://example.com/" Nothing `mappend` DocString "\n"
+ }
+
+ , ParseTest {
+ input = "<http://example.com/ some link>"
+ , result = Just . DocParagraph $ hyperlink "http://example.com/" (Just "some link") `mappend` DocString "\n"
+ }
]
+hyperlink :: String -> Maybe String -> Doc RdrName
+hyperlink url = DocHyperlink . Hyperlink url
main :: IO ()
main = do