// OCHamcrest by Jon Reid, https://qualitycoding.org/ // Copyright 2019 hamcrest.org. See LICENSE.txt #import NS_ASSUME_NONNULL_BEGIN /*! * @abstract Matches if any entry in a dictionary has a key satisfying the nested matcher. */ @interface HCIsDictionaryContainingKey : HCBaseMatcher - (instancetype)initWithKeyMatcher:(id )keyMatcher NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; @end FOUNDATION_EXPORT id HC_hasKey(id keyMatcher); #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates a matcher for NSDictionaries that matches when the examined dictionary contains * at least key that satisfies the specified matcher. * @param keyMatcher The matcher to satisfy for the key, or an expected value for equalTo matching. * @discussion Any argument that is not a matcher is implicitly wrapped in an equalTo * matcher to check for equality. * * Examples
*
assertThat(myDictionary, hasEntry(equalTo(\@"foo")))
*
assertThat(myDictionary, hasEntry(\@"foo"))
* * Name Clash
* In the event of a name clash, #define HC_DISABLE_SHORT_SYNTAX and use the synonym * HC_hasKey instead. */ static inline id hasKey(id keyMatcher) { return HC_hasKey(keyMatcher); } #endif NS_ASSUME_NONNULL_END