Fix bug in combination of preferred and required content settings. When one was set to the empty string and the other set to some expression, this bug caused all files to be wanted, instead of only files matching the expression.
Avoid: MAny `MOr` otherexpression Which matches anything.
This commit is contained in:
parent
7088bc8621
commit
16947ef654
5 changed files with 51 additions and 2 deletions
|
@ -27,6 +27,7 @@ module Utility.Matcher (
|
|||
matchM,
|
||||
matchMrun,
|
||||
isEmpty,
|
||||
combineMatchers,
|
||||
|
||||
prop_matcher_sane
|
||||
) where
|
||||
|
@ -142,6 +143,14 @@ isEmpty :: Matcher a -> Bool
|
|||
isEmpty MAny = True
|
||||
isEmpty _ = False
|
||||
|
||||
{- Combines two matchers, yielding a matcher that will match anything
|
||||
- both do. -}
|
||||
combineMatchers :: Matcher a -> Matcher a -> Matcher a
|
||||
combineMatchers a b
|
||||
| isEmpty a = b
|
||||
| isEmpty b = a
|
||||
| otherwise = a `MOr` b
|
||||
|
||||
prop_matcher_sane :: Bool
|
||||
prop_matcher_sane = all (\m -> match dummy m ()) $ map generate
|
||||
[ [Operation True]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue