[commit: haddock] master: Add very simple QuickCheck properties for source parser spec. (5ddb425)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:41:31 UTC 2015


Repository : ssh://git@git.haskell.org/haddock

On branch  : master
Link       : http://git.haskell.org/haddock.git/commitdiff/5ddb425bbdc29efdd314ffc18db6c8e6c3609d24

>---------------------------------------------------------------

commit 5ddb425bbdc29efdd314ffc18db6c8e6c3609d24
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Sun Jun 28 23:58:24 2015 +0200

    Add very simple QuickCheck properties for source parser spec.


>---------------------------------------------------------------

5ddb425bbdc29efdd314ffc18db6c8e6c3609d24
 haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs b/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs
index 5e69b44..38cdbc8 100644
--- a/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs
+++ b/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs
@@ -2,6 +2,7 @@ module Haddock.Backends.Hyperlinker.ParserSpec (main, spec) where
 
 
 import Test.Hspec
+import Test.QuickCheck
 
 import Haddock.Backends.Hyperlinker.Parser
 
@@ -18,6 +19,12 @@ spec = do
 parseSpec :: Spec
 parseSpec = do
 
+    it "is total" $
+        property $ \src -> length (parse src) `shouldSatisfy` (>= 0)
+
+    it "retains file layout" $
+        property $ \src -> concatMap tkValue (parse src) == src
+
     context "when parsing single-line comments" $ do
 
         it "should ignore content until the end of line" $



More information about the ghc-commits mailing list