OCHamcrest
|
Matchers that perform text comparisons.
Defines | |
#define | equalToIgnoringCase HC_equalToIgnoringCase |
equalToIgnoringCase(aString) - Matches if object is a string equal to a given string, ignoring case differences. | |
#define | equalToIgnoringWhiteSpace HC_equalToIgnoringWhiteSpace |
equalToIgnoringWhiteSpace(aString) - Matches if object is a string equal to a given string, ignoring differences in whitespace. | |
#define | containsString HC_containsString |
containsString(aString) - Matches if object is a string containing a given string. | |
#define | stringContainsInOrder HC_stringContainsInOrder |
stringContainsInOrder(firstString, ...) - Matches if object is a string containing a given list of substrings in relative order. | |
#define | endsWith HC_endsWith |
endsWith(aString) - Matches if object is a string ending with a given string. | |
#define | startsWith HC_startsWith |
startsWith(aString) - Matches if object is a string starting with a given string. |
Matchers that perform text comparisons.
#define containsString HC_containsString |
containsString(aString) - Matches if object is a string containing a given string.
aString | The string to search for. This value must not be nil . |
This matcher first checks whether the evaluated object is a string. If so, it checks whether it contains aString.
Example:
will match "abcdefg".
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_containsString
instead.)
#define endsWith HC_endsWith |
endsWith(aString) - Matches if object is a string ending with a given string.
aString | The string to search for. This value must not be nil . |
This matcher first checks whether the evaluated object is a string. If so, it checks if aString matches the ending characters of the evaluated object.
Example:
will match "foobar".
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_endsWith
instead.)
equalToIgnoringCase(aString) - Matches if object is a string equal to a given string, ignoring case differences.
aString | The string to compare against as the expected value. This value must not be nil . |
This matcher first checks whether the evaluated object is a string. If so, it compares it with aString, ignoring differences of case.
Example:
will match "heLLo WorlD".
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_equalToIgnoringCase
instead.)
equalToIgnoringWhiteSpace(aString) - Matches if object is a string equal to a given string, ignoring differences in whitespace.
aString | The string to compare against as the expected value. This value must not be nil . |
This matcher first checks whether the evaluated object is a string. If so, it compares it with aString, ignoring differences in runs of whitespace.
Example:
will match
"hello world"
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_equalToIgnoringWhiteSpace
instead.)
#define startsWith HC_startsWith |
startsWith(aString) - Matches if object is a string starting with a given string.
aString | The string to search for. This value must not be nil . |
This matcher first checks whether the evaluated object is a string. If so, it checks if aString matches the beginning characters of the evaluated object.
Example:
will match "foobar".
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_startsWith
instead.)
stringContainsInOrder(firstString, ...) - Matches if object is a string containing a given list of substrings in relative order.
firstString,... | A comma-separated list of strings ending with nil . |
This matcher first checks whether the evaluated object is a string. If so, it checks whether it contains a given list of strings, in relative order to each other. The searches are performed starting from the beginning of the evaluated string.
Example:
will match "abcdefghijklm".
(In the event of a name clash, don't #define HC_SHORTHAND
and use the synonym HC_stringContainsInOrder
instead.)