diff options
author | David Waern <david.waern@gmail.com> | 2012-07-23 16:50:40 +0200 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2012-07-23 16:50:40 +0200 |
commit | c3811c56988ecae6c3d3b2c4c202474de012e9ed (patch) | |
tree | c7d897e98c3523d056d38745b794c681b30a38f6 /tests/unit-tests | |
parent | 83a2a6ab67b25eec42c50b99b0b594313b8abe44 (diff) | |
parent | 0730c1b4088fd5d2c36671b0adf3c9e11222e233 (diff) |
Merge branch 'dev' of https://github.com/sol/haddock into ghc-7.6
Conflicts:
src/Haddock/InterfaceFile.hs
Diffstat (limited to 'tests/unit-tests')
-rw-r--r-- | tests/unit-tests/.ghci | 2 | ||||
-rw-r--r-- | tests/unit-tests/parsetests.hs | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/unit-tests/.ghci b/tests/unit-tests/.ghci index 10563664..dcc5b13d 100644 --- a/tests/unit-tests/.ghci +++ b/tests/unit-tests/.ghci @@ -1 +1 @@ -:set -i../../src -i../../dist/build/autogen -i../../dist/build/haddock/haddock-tmp/ -packageghc -optP-include -optP../../dist/build/autogen/cabal_macros.h -XCPP -XDeriveDataTypeable -XScopedTypeVariables -XMagicHash +:set -i../../src -i../../dist/build/autogen -i../../dist/build/haddock/haddock-tmp/ -packageghc -optP-include -optP../../dist/build/autogen/cabal_macros.h 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 |