// OCHamcrest by Jon Reid, https://qualitycoding.org/ // Copyright 2019 hamcrest.org. See LICENSE.txt #import NS_ASSUME_NONNULL_BEGIN /*! * @abstract Tests if string that contains a list of substrings in relative order. */ @interface HCStringContainsInOrder : HCBaseMatcher - (instancetype)initWithSubstrings:(NSArray *)substrings NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; @end FOUNDATION_EXPORT id HC_stringContainsInOrderIn(NSArray *substrings); #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates matcher for NSStrings that matches when the examined string contains all of the * specified substrings, considering the order of their appearance. * @param substrings An array of strings. * @discussion * Example
*
assertThat(\@"myfoobarbaz", stringContainsInOrderIn(\@[\@"bar", \@"foo"]))
* fails as "foo" occurs before "bar" in the string "myfoobarbaz" * * Name Clash
* In the event of a name clash, #define HC_DISABLE_SHORT_SYNTAX and use the synonym * HC_stringContainsInOrderIn instead. */ static inline id stringContainsInOrderIn(NSArray *substrings) { return HC_stringContainsInOrderIn(substrings); } #endif FOUNDATION_EXPORT id HC_stringContainsInOrder(NSString *substrings, ...) NS_REQUIRES_NIL_TERMINATION; #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates matcher for NSStrings that matches when the examined string contains all of the * specified substrings, considering the order of their appearance. * @param substrings... A comma-separated list of strings, ending with nil. * @discussion * Example
*
assertThat(\@"myfoobarbaz", stringContainsInOrder(\@"bar", \@"foo", nil))
* fails as "foo" occurs before "bar" in the string "myfoobarbaz" * * Name Clash
* In the event of a name clash, #define HC_DISABLE_SHORT_SYNTAX and use the synonym * HC_stringContainsInOrder instead. */ #define stringContainsInOrder(substrings...) HC_stringContainsInOrder(substrings) #endif NS_ASSUME_NONNULL_END