method-0.4.0.0: rebindable methods for improving testability
LicenseBSD-3
Maintainerautotaker@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Method.Matcher

Description

 
Synopsis

Documentation

anything :: Matcher a Source #

Matcher that matches anything

when :: Matcher a -> Matcher a Source #

synonym of id function. Use this function for improving readability

type Matcher a = a -> Bool Source #

class TupleLike a where Source #

Associated Types

type AsTuple a Source #

Methods

fromTuple :: AsTuple a -> a Source #

toTuple :: a -> AsTuple a Source #

Instances

Instances details
TupleLike Nil Source # 
Instance details

Defined in Control.Method.Internal

Associated Types

type AsTuple Nil Source #

TupleLike (a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil))))))) Source # 
Instance details

Defined in Control.Method.Internal

Associated Types

type AsTuple (a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil))))))) Source #

Methods

fromTuple :: AsTuple (a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil))))))) -> a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil)))))) Source #

toTuple :: (a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil))))))) -> AsTuple (a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil))))))) Source #

TupleLike (a :* (b :* (c :* (d :* (e :* (f :* Nil)))))) Source # 
Instance details

Defined in Control.Method.Internal

Associated Types

type AsTuple (a :* (b :* (c :* (d :* (e :* (f :* Nil)))))) Source #

Methods

fromTuple :: AsTuple (a :* (b :* (c :* (d :* (e :* (f :* Nil)))))) -> a :* (b :* (c :* (d :* (e :* (f :* Nil))))) Source #

toTuple :: (a :* (b :* (c :* (d :* (e :* (f :* Nil)))))) -> AsTuple (a :* (b :* (c :* (d :* (e :* (f :* Nil)))))) Source #

TupleLike (a :* (b :* (c :* (d :* (e :* Nil))))) Source # 
Instance details

Defined in Control.Method.Internal

Associated Types

type AsTuple (a :* (b :* (c :* (d :* (e :* Nil))))) Source #

Methods

fromTuple :: AsTuple (a :* (b :* (c :* (d :* (e :* Nil))))) -> a :* (b :* (c :* (d :* (e :* Nil)))) Source #

toTuple :: (a :* (b :* (c :* (d :* (e :* Nil))))) -> AsTuple (a :* (b :* (c :* (d :* (e :* Nil))))) Source #

TupleLike (a :* (b :* (c :* (d :* Nil)))) Source # 
Instance details

Defined in Control.Method.Internal

Associated Types

type AsTuple (a :* (b :* (c :* (d :* Nil)))) Source #

Methods

fromTuple :: AsTuple (a :* (b :* (c :* (d :* Nil)))) -> a :* (b :* (c :* (d :* Nil))) Source #

toTuple :: (a :* (b :* (c :* (d :* Nil)))) -> AsTuple (a :* (b :* (c :* (d :* Nil)))) Source #

TupleLike (a :* (b :* (c :* Nil))) Source # 
Instance details

Defined in Control.Method.Internal

Associated Types

type AsTuple (a :* (b :* (c :* Nil))) Source #

Methods

fromTuple :: AsTuple (a :* (b :* (c :* Nil))) -> a :* (b :* (c :* Nil)) Source #

toTuple :: (a :* (b :* (c :* Nil))) -> AsTuple (a :* (b :* (c :* Nil))) Source #

TupleLike (a :* (b :* Nil)) Source # 
Instance details

Defined in Control.Method.Internal

Associated Types

type AsTuple (a :* (b :* Nil)) Source #

Methods

fromTuple :: AsTuple (a :* (b :* Nil)) -> a :* (b :* Nil) Source #

toTuple :: (a :* (b :* Nil)) -> AsTuple (a :* (b :* Nil)) Source #

TupleLike (a :* Nil) Source # 
Instance details

Defined in Control.Method.Internal

Associated Types

type AsTuple (a :* Nil) Source #

Methods

fromTuple :: AsTuple (a :* Nil) -> a :* Nil Source #

toTuple :: (a :* Nil) -> AsTuple (a :* Nil) Source #

class TupleLike a => ArgsMatcher a where Source #

Matcher for Args

>>> args ((==2), (>3)) (2 :* 4 :* Nil)
True
>>> args even (1 :* Nil)
False
>>> args () Nil
True

Associated Types

type EachMatcher a Source #

Methods

args :: EachMatcher a -> Matcher a Source #

Convert a tuple of matchers to a matcher of tuples

Instances

Instances details
ArgsMatcher Nil Source # 
Instance details

Defined in Test.Method.Matcher

Associated Types

type EachMatcher Nil Source #

ArgsMatcher (a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil))))))) Source # 
Instance details

Defined in Test.Method.Matcher

Associated Types

type EachMatcher (a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil))))))) Source #

Methods

args :: EachMatcher (a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil))))))) -> Matcher (a :* (b :* (c :* (d :* (e :* (f :* (g :* Nil))))))) Source #

ArgsMatcher (a :* (b :* (c :* (d :* (e :* (f :* Nil)))))) Source # 
Instance details

Defined in Test.Method.Matcher

Associated Types

type EachMatcher (a :* (b :* (c :* (d :* (e :* (f :* Nil)))))) Source #

Methods

args :: EachMatcher (a :* (b :* (c :* (d :* (e :* (f :* Nil)))))) -> Matcher (a :* (b :* (c :* (d :* (e :* (f :* Nil)))))) Source #

ArgsMatcher (a :* (b :* (c :* (d :* (e :* Nil))))) Source # 
Instance details

Defined in Test.Method.Matcher

Associated Types

type EachMatcher (a :* (b :* (c :* (d :* (e :* Nil))))) Source #

Methods

args :: EachMatcher (a :* (b :* (c :* (d :* (e :* Nil))))) -> Matcher (a :* (b :* (c :* (d :* (e :* Nil))))) Source #

ArgsMatcher (a :* (b :* (c :* (d :* Nil)))) Source # 
Instance details

Defined in Test.Method.Matcher

Associated Types

type EachMatcher (a :* (b :* (c :* (d :* Nil)))) Source #

Methods

args :: EachMatcher (a :* (b :* (c :* (d :* Nil)))) -> Matcher (a :* (b :* (c :* (d :* Nil)))) Source #

ArgsMatcher (a :* (b :* (c :* Nil))) Source # 
Instance details

Defined in Test.Method.Matcher

Associated Types

type EachMatcher (a :* (b :* (c :* Nil))) Source #

Methods

args :: EachMatcher (a :* (b :* (c :* Nil))) -> Matcher (a :* (b :* (c :* Nil))) Source #

ArgsMatcher (a :* (b :* Nil)) Source # 
Instance details

Defined in Test.Method.Matcher

Associated Types

type EachMatcher (a :* (b :* Nil)) Source #

Methods

args :: EachMatcher (a :* (b :* Nil)) -> Matcher (a :* (b :* Nil)) Source #

ArgsMatcher (a :* Nil) Source # 
Instance details

Defined in Test.Method.Matcher

Associated Types

type EachMatcher (a :* Nil) Source #

Methods

args :: EachMatcher (a :* Nil) -> Matcher (a :* Nil) Source #

args' :: TupleLike a => Matcher (AsTuple a) -> Matcher a Source #

Convert a tuple matcher to a tuple-like matcher.

>>> args' (\(a, b) -> a * b == 10) (2 :* 5 :* Nil)
True
>>> args' (\(a, b) -> a * b == 10) (2 :* 4 :* Nil)
False