[commit: packages/binary] master: Label test samples in prop_label. (23f64d9)
git at git.haskell.org
git at git.haskell.org
Sun Dec 14 17:54:27 UTC 2014
Repository : ssh://git@git.haskell.org/binary
On branch : master
Link : http://git.haskell.org/packages/binary.git/commitdiff/23f64d90ab2404baa5479667ce93b33a2760b400
>---------------------------------------------------------------
commit 23f64d90ab2404baa5479667ce93b33a2760b400
Author: Lennart Kolmodin <kolmodin at gmail.com>
Date: Sun Mar 23 10:26:29 2014 +0400
Label test samples in prop_label.
>---------------------------------------------------------------
23f64d90ab2404baa5479667ce93b33a2760b400
tests/Action.hs | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/Action.hs b/tests/Action.hs
index 5981b6b..f32d748 100644
--- a/tests/Action.hs
+++ b/tests/Action.hs
@@ -138,8 +138,10 @@ prop_label =
Nothing -> error "expected labels"
expectedMsg | null labels = "fail"
| otherwise = concat $ intersperse "\n" ("fail":labels)
- in if (msg == expectedMsg) then True else error (show msg ++ " vs. " ++ show expectedMsg)
- Right (inp, off, value) -> True
+ in if (msg == expectedMsg)
+ then label ("labels: " ++ show (length labels)) True
+ else error (show msg ++ " vs. " ++ show expectedMsg)
+ Right (inp, off, value) -> label "test case without 'fail'" True
collectLabels :: [Action] -> Maybe [String]
collectLabels = go []
@@ -216,7 +218,9 @@ eval inp acts0 = go 0 acts0 >> return ()
Just offset -> return offset
gen_actions :: Bool -> Gen [Action]
-gen_actions genFail = sized (go False)
+gen_actions genFail = do
+ acts <- sized (go False)
+ return (if genFail then (acts ++ [Fail]) else acts)
where
go :: Bool -> Int -> Gen [Action]
go _ 0 = return []
More information about the ghc-commits
mailing list