diff options
Diffstat (limited to 'tests/unit-tests')
-rw-r--r-- | tests/unit-tests/.ghci | 1 | ||||
-rw-r--r-- | tests/unit-tests/parsetests.hs | 69 | ||||
-rwxr-xr-x | tests/unit-tests/runparsetests.sh | 15 |
3 files changed, 0 insertions, 85 deletions
diff --git a/tests/unit-tests/.ghci b/tests/unit-tests/.ghci deleted file mode 100644 index 10563664..00000000 --- a/tests/unit-tests/.ghci +++ /dev/null @@ -1 +0,0 @@ -: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 diff --git a/tests/unit-tests/parsetests.hs b/tests/unit-tests/parsetests.hs deleted file mode 100644 index 7180a79e..00000000 --- a/tests/unit-tests/parsetests.hs +++ /dev/null @@ -1,69 +0,0 @@ -{-# LANGUAGE StandaloneDeriving, FlexibleInstances, UndecidableInstances, IncoherentInstances #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -module Main (main) where - -import Test.HUnit -import RdrName (RdrName) -import DynFlags (defaultDynFlags) -import Haddock.Lex (tokenise) -import Haddock.Parse (parseParas) -import Haddock.Types -import Outputable - -instance Outputable a => Show a where - show = showSDoc . ppr - -deriving instance Show a => Show (Doc a) -deriving instance Eq a =>Eq (Doc a) - -data ParseTest = ParseTest { - input :: String - , result :: (Maybe (Doc RdrName)) - } - -tests :: [ParseTest] -tests = [ - ParseTest { - input = "foobar" - , result = Just $ DocParagraph $ DocString "foobar\n" - } - - , ParseTest { - input = "foobar\n\n>>> fib 10\n55" - , result = Just $ DocAppend (DocParagraph $ DocString "foobar\n") (DocExamples $ [Example "fib 10" ["55"]]) - } - - , ParseTest { - input = "foobar\n>>> fib 10\n55" - , result = Nothing -- parse error - } - - , ParseTest { - input = "foobar\n\n> some code" - , result = Just (DocAppend (DocParagraph (DocString "foobar\n")) (DocCodeBlock (DocString " some code\n"))) - } - - , ParseTest { - input = "foobar\n> some code" - , result = Nothing -- parse error - } - - -- test <BLANKLINE> support - , ParseTest { - input = ">>> putFooBar\nfoo\n<BLANKLINE>\nbar" - , result = Just $ DocExamples $ [Example "putFooBar" ["foo","","bar"]] - } - ] - - -main :: IO () -main = do - _ <- runTestTT $ TestList $ map toTestCase tests - return (); - where - - toTestCase :: ParseTest -> Test - toTestCase (ParseTest s r) = TestCase $ assertEqual s r (parse s) - - parse :: String -> Maybe (Doc RdrName) - parse s = parseParas $ tokenise (defaultDynFlags undefined) s (0,0) diff --git a/tests/unit-tests/runparsetests.sh b/tests/unit-tests/runparsetests.sh deleted file mode 100755 index ead0ccf5..00000000 --- a/tests/unit-tests/runparsetests.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -cd `dirname $0` - -runhaskell \ - -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 \ - parsetests.hs |