OCHamcrest
Defines
Decorator Matchers
Matcher Library

Matchers that decorate other matchers for better expression.
More...

Defines

#define describedAs   HC_describedAs
 describedAs(description, matcher, ...) - Adds custom failure description to a given matcher.
#define is   HC_is
 is(aMatcher) - Decorates another matcher, or provides a shortcut to the frequently used is(equalTo(x)).

Detailed Description

Matchers that decorate other matchers for better expression.

Define Documentation

describedAs(description, matcher, ...) - Adds custom failure description to a given matcher.

Parameters:
descriptionOverrides the matcher's description.
matcher,...The matcher to satisfy, followed by a comma-separated list of substitution values ending with nil.

The description may contain substitution placeholders %0, %1, etc. These will be replaced by any values that follow the matcher.

(In the event of a name clash, don't #define HC_SHORTHAND and use the synonym HC_describedAs instead.)

#define is   HC_is

is(aMatcher) - Decorates another matcher, or provides a shortcut to the frequently used is(equalTo(x)).

Parameters:
aMatcherThe matcher to satisfy, or an expected value for equalTo matching.

This matcher compares the evaluated object to the given matcher.

If the aMatcher argument is a matcher, its behavior is retained, but the test may be more expressive. For example:

If the aMatcher argument is not a matcher, it is wrapped in an equalTo matcher. This makes the following statements equivalent:

Choose the style that makes your expression most readable. This will vary depending on context.

(In the event of a name clash, don't #define HC_SHORTHAND and use the synonym HC_is instead.)