diff options
author | Simon Hengel <sol@typeful.net> | 2012-01-11 14:25:48 +0100 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2012-02-04 00:48:25 +0100 |
commit | 170646139ac4b411c4f036953688f18833fdf5f1 (patch) | |
tree | 5dd3f9ec73ce380d85a6afb9a0589fc8f9f460aa /tests/unit-tests/parsetests.hs | |
parent | 101a9279fe28a817c2f274e365be2d7688fa6941 (diff) |
Set unit tests for parser back to work
Diffstat (limited to 'tests/unit-tests/parsetests.hs')
-rw-r--r-- | tests/unit-tests/parsetests.hs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/unit-tests/parsetests.hs b/tests/unit-tests/parsetests.hs index e0645401..7180a79e 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) |