Repository : ssh://darcs.haskell.org//srv/darcs/haddock On branch : local
http://hackage.haskell.org/trac/ghc/changeset/912a09c1aa5a1dd574902b9ab9bc8110894d8222 >--------------------------------------------------------------- commit 912a09c1aa5a1dd574902b9ab9bc8110894d8222 Author: Simon Hengel <[email protected]> Date: Wed Jan 11 14:25:48 2012 +0100 Set unit tests for parser back to work >--------------------------------------------------------------- tests/unit-tests/.ghci | 1 + tests/unit-tests/parsetests.hs | 15 +++++++++++---- tests/unit-tests/runparsetests.sh | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/tests/unit-tests/.ghci b/tests/unit-tests/.ghci new file mode 100644 index 0000000..1056366 --- /dev/null +++ b/tests/unit-tests/.ghci @@ -0,0 +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 diff --git a/tests/unit-tests/parsetests.hs b/tests/unit-tests/parsetests.hs index e064540..7180a79 100644 --- a/tests/unit-tests/parsetests.hs +++ b/tests/unit-tests/parsetests.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE StandaloneDeriving, FlexibleInstances, UndecidableInstances, IncoherentInstances #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} module Main (main) where import Test.HUnit @@ -6,9 +8,13 @@ import DynFlags (defaultDynFlags) import Haddock.Lex (tokenise) import Haddock.Parse (parseParas) import Haddock.Types +import Outputable -instance Show RdrName where - show x = "RdrName" +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 @@ -50,13 +56,14 @@ tests = [ ] +main :: IO () main = do _ <- runTestTT $ TestList $ map toTestCase tests return (); where toTestCase :: ParseTest -> Test - toTestCase (ParseTest input result) = TestCase $ assertEqual input result (parse input) + toTestCase (ParseTest s r) = TestCase $ assertEqual s r (parse s) parse :: String -> Maybe (Doc RdrName) - parse input = parseParas $ tokenise defaultDynFlags input (0,0) + parse s = parseParas $ tokenise (defaultDynFlags undefined) s (0,0) diff --git a/tests/unit-tests/runparsetests.sh b/tests/unit-tests/runparsetests.sh old mode 100644 new mode 100755 index 1dae69c..ead0ccf --- a/tests/unit-tests/runparsetests.sh +++ b/tests/unit-tests/runparsetests.sh @@ -1,15 +1,15 @@ #!/bin/sh cd `dirname $0` -runhaskell -hide-all-packages -cpp \ - -packagecontainers \ - -packagearray \ - -packagebase \ +runhaskell \ + -i../../src \ + -i../../dist/build/autogen \ + -i../../dist/build/haddock/haddock-tmp/ \ -packageghc \ - -packagexhtml \ - -packageghc-paths \ - -packageHUnit \ - -i../../dist/build/ \ - -i../../src/ \ - -optP-include -optP../../dist/build/autogen/cabal_macros.h \ + -optP-include \ + -optP../../dist/build/autogen/cabal_macros.h \ + -XCPP \ + -XDeriveDataTypeable \ + -XScopedTypeVariables \ + -XMagicHash \ parsetests.hs _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
