Adds cocoapods for libraries.
Adds OCMockito and OCHamcrest libs.
This commit is contained in:
46
iOS/Pods/OCHamcrest/Source/Library/Text/HCIsEqualCompressingWhiteSpace.h
generated
Normal file
46
iOS/Pods/OCHamcrest/Source/Library/Text/HCIsEqualCompressingWhiteSpace.h
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import <OCHamcrest/HCBaseMatcher.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @abstract Tests if a string is equal to another string, when whitespace differences are (mostly) ignored.
|
||||
*/
|
||||
@interface HCIsEqualCompressingWhiteSpace : HCBaseMatcher
|
||||
|
||||
- (instancetype)initWithString:(NSString *)string NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
FOUNDATION_EXPORT id HC_equalToCompressingWhiteSpace(NSString *expectedString);
|
||||
|
||||
#ifndef HC_DISABLE_SHORT_SYNTAX
|
||||
/*!
|
||||
* @abstract Creates a matcher for NSStrings that matches when the examined string is equal to the
|
||||
* specified expected string, when whitespace differences are (mostly) ignored.
|
||||
* @param expectedString The expected value of matched strings. (Must not be <code>nil</code>.)
|
||||
* @discussion To be exact, the following whitespace rules are applied:
|
||||
* <ul>
|
||||
* <li>all leading and trailing whitespace of both the <em>expectedString</em> and the examined string are ignored</li>
|
||||
* <li>any remaining whitespace, appearing within either string, is collapsed to a single space before comparison</li>
|
||||
* </ul>
|
||||
*
|
||||
* <b>Example</b><br />
|
||||
* <pre>assertThat(\@" my\tfoo bar ", equalToCompressingWhiteSpace(\@" my foo bar"))</pre>
|
||||
*
|
||||
* <b>Name Clash</b><br />
|
||||
* In the event of a name clash, <code>#define HC_DISABLE_SHORT_SYNTAX</code> and use the synonym
|
||||
* HC_equalToCompressingWhiteSpace instead.
|
||||
*/
|
||||
static inline id equalToCompressingWhiteSpace(NSString *expectedString)
|
||||
{
|
||||
return HC_equalToCompressingWhiteSpace(expectedString);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
62
iOS/Pods/OCHamcrest/Source/Library/Text/HCIsEqualCompressingWhiteSpace.m
generated
Normal file
62
iOS/Pods/OCHamcrest/Source/Library/Text/HCIsEqualCompressingWhiteSpace.m
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import "HCIsEqualCompressingWhiteSpace.h"
|
||||
|
||||
#import "HCRequireNonNilObject.h"
|
||||
|
||||
|
||||
static NSString *stripSpaces(NSString *string)
|
||||
{
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\s+"
|
||||
options:0
|
||||
error:NULL];
|
||||
NSString *modifiedString = [regex stringByReplacingMatchesInString:string
|
||||
options:0
|
||||
range:NSMakeRange(0, string.length)
|
||||
withTemplate:@" "];
|
||||
return [modifiedString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
}
|
||||
|
||||
|
||||
@interface HCIsEqualCompressingWhiteSpace ()
|
||||
@property (nonatomic, copy, readonly) NSString *originalString;
|
||||
@property (nonatomic, copy, readonly) NSString *strippedString;
|
||||
@end
|
||||
|
||||
@implementation HCIsEqualCompressingWhiteSpace
|
||||
|
||||
- (instancetype)initWithString:(NSString *)string
|
||||
{
|
||||
HCRequireNonNilObject(string);
|
||||
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
_originalString = [string copy];
|
||||
_strippedString = [stripSpaces(string) copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)matches:(nullable id)item
|
||||
{
|
||||
if (![item isKindOfClass:[NSString class]])
|
||||
return NO;
|
||||
|
||||
return [self.strippedString isEqualToString:stripSpaces(item)];
|
||||
}
|
||||
|
||||
- (void)describeTo:(id <HCDescription>)description
|
||||
{
|
||||
[[description appendDescriptionOf:self.originalString]
|
||||
appendText:@" ignoring whitespace"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
id HC_equalToCompressingWhiteSpace(NSString *expectedString)
|
||||
{
|
||||
return [[HCIsEqualCompressingWhiteSpace alloc] initWithString:expectedString];
|
||||
}
|
||||
41
iOS/Pods/OCHamcrest/Source/Library/Text/HCIsEqualIgnoringCase.h
generated
Normal file
41
iOS/Pods/OCHamcrest/Source/Library/Text/HCIsEqualIgnoringCase.h
generated
Normal file
@@ -0,0 +1,41 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import <OCHamcrest/HCBaseMatcher.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @abstract Tests if a string is equal to another string, regardless of the case.
|
||||
*/
|
||||
@interface HCIsEqualIgnoringCase : HCBaseMatcher
|
||||
|
||||
- (instancetype)initWithString:(NSString *)string NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
FOUNDATION_EXPORT id HC_equalToIgnoringCase(NSString *expectedString);
|
||||
|
||||
#ifndef HC_DISABLE_SHORT_SYNTAX
|
||||
/*!
|
||||
* @abstract Creates a matcher for NSStrings that matches when the examined string is equal to the
|
||||
* specified expected string, ignoring case differences.
|
||||
* @param expectedString The expected value of matched strings. (Must not be <code>nil</code>.)
|
||||
* @discussion
|
||||
* <b>Example</b><br />
|
||||
* <pre>assertThat(\@"Foo", equalToIgnoringCase(\@"FOO"))</pre>
|
||||
*
|
||||
* <b>Name Clash</b><br />
|
||||
* In the event of a name clash, <code>#define HC_DISABLE_SHORT_SYNTAX</code> and use the synonym
|
||||
* HC_equalToIgnoringCase instead.
|
||||
*/
|
||||
static inline id equalToIgnoringCase(NSString *expectedString)
|
||||
{
|
||||
return HC_equalToIgnoringCase(expectedString);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
45
iOS/Pods/OCHamcrest/Source/Library/Text/HCIsEqualIgnoringCase.m
generated
Normal file
45
iOS/Pods/OCHamcrest/Source/Library/Text/HCIsEqualIgnoringCase.m
generated
Normal file
@@ -0,0 +1,45 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import "HCIsEqualIgnoringCase.h"
|
||||
|
||||
#import "HCRequireNonNilObject.h"
|
||||
|
||||
|
||||
@interface HCIsEqualIgnoringCase ()
|
||||
@property (nonatomic, copy, readonly) NSString *string;
|
||||
@end
|
||||
|
||||
@implementation HCIsEqualIgnoringCase
|
||||
|
||||
- (instancetype)initWithString:(NSString *)string
|
||||
{
|
||||
HCRequireNonNilObject(string);
|
||||
|
||||
self = [super init];
|
||||
if (self)
|
||||
_string = [string copy];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)matches:(nullable id)item
|
||||
{
|
||||
if (![item isKindOfClass:[NSString class]])
|
||||
return NO;
|
||||
|
||||
return [self.string caseInsensitiveCompare:item] == NSOrderedSame;
|
||||
}
|
||||
|
||||
- (void)describeTo:(id <HCDescription>)description
|
||||
{
|
||||
[[description appendDescriptionOf:self.string]
|
||||
appendText:@" ignoring case"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
id HC_equalToIgnoringCase(NSString *expectedString)
|
||||
{
|
||||
return [[HCIsEqualIgnoringCase alloc] initWithString:expectedString];
|
||||
}
|
||||
39
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringContains.h
generated
Normal file
39
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringContains.h
generated
Normal file
@@ -0,0 +1,39 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import <OCHamcrest/HCSubstringMatcher.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @abstract Tests if string that contains a substring.
|
||||
*/
|
||||
@interface HCStringContains : HCSubstringMatcher
|
||||
@end
|
||||
|
||||
|
||||
FOUNDATION_EXPORT id HC_containsSubstring(NSString *substring);
|
||||
|
||||
#ifndef HC_DISABLE_SHORT_SYNTAX
|
||||
/*!
|
||||
* @abstract Creates a matcher that matches when the examined object is a string containing the
|
||||
* specified substring anywhere.
|
||||
* @param substring The string to search for. (Must not be <code>nil</code>.)
|
||||
* @discussion The matcher invokes <code>-rangeOfString:</code> on the examined object, passing the
|
||||
* specified <em>substring</em> and matching if it is found.
|
||||
*
|
||||
* <b>Example</b><br />
|
||||
* <pre>assertThat(\@"myStringOfNote", containsSubstring(\@"ring"))</pre>
|
||||
*
|
||||
* <b>Name Clash</b><br />
|
||||
* In the event of a name clash, <code>#define HC_DISABLE_SHORT_SYNTAX</code> and use the synonym
|
||||
* HC_containsSubstring instead.
|
||||
*/
|
||||
static inline id containsSubstring(NSString *substring)
|
||||
{
|
||||
return HC_containsSubstring(substring);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
28
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringContains.m
generated
Normal file
28
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringContains.m
generated
Normal file
@@ -0,0 +1,28 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import "HCStringContains.h"
|
||||
|
||||
|
||||
@implementation HCStringContains
|
||||
|
||||
- (BOOL)matches:(nullable id)item
|
||||
{
|
||||
if (![item respondsToSelector:@selector(rangeOfString:)])
|
||||
return NO;
|
||||
|
||||
return [item rangeOfString:self.substring].location != NSNotFound;
|
||||
}
|
||||
|
||||
- (NSString *)relationship
|
||||
{
|
||||
return @"containing";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
id <HCMatcher> HC_containsSubstring(NSString *substring)
|
||||
{
|
||||
return [[HCStringContains alloc] initWithSubstring:substring];
|
||||
}
|
||||
62
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringContainsInOrder.h
generated
Normal file
62
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringContainsInOrder.h
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import <OCHamcrest/HCBaseMatcher.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @abstract Tests if string that contains a list of substrings in relative order.
|
||||
*/
|
||||
@interface HCStringContainsInOrder : HCBaseMatcher
|
||||
|
||||
- (instancetype)initWithSubstrings:(NSArray<NSString *> *)substrings NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
FOUNDATION_EXPORT id HC_stringContainsInOrderIn(NSArray<NSString *> *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
|
||||
* <b>Example</b><br />
|
||||
* <pre>assertThat(\@"myfoobarbaz", stringContainsInOrderIn(\@[\@"bar", \@"foo"]))</pre>
|
||||
* fails as "foo" occurs before "bar" in the string "myfoobarbaz"
|
||||
*
|
||||
* <b>Name Clash</b><br />
|
||||
* In the event of a name clash, <code>#define HC_DISABLE_SHORT_SYNTAX</code> and use the synonym
|
||||
* HC_stringContainsInOrderIn instead.
|
||||
*/
|
||||
static inline id stringContainsInOrderIn(NSArray<NSString *> *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 <code>nil</code>.
|
||||
* @discussion
|
||||
* <b>Example</b><br />
|
||||
* <pre>assertThat(\@"myfoobarbaz", stringContainsInOrder(\@"bar", \@"foo", nil))</pre>
|
||||
* fails as "foo" occurs before "bar" in the string "myfoobarbaz"
|
||||
*
|
||||
* <b>Name Clash</b><br />
|
||||
* In the event of a name clash, <code>#define HC_DISABLE_SHORT_SYNTAX</code> and use the synonym
|
||||
* HC_stringContainsInOrder instead.
|
||||
*/
|
||||
#define stringContainsInOrder(substrings...) HC_stringContainsInOrder(substrings)
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
78
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringContainsInOrder.m
generated
Normal file
78
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringContainsInOrder.m
generated
Normal file
@@ -0,0 +1,78 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import "HCStringContainsInOrder.h"
|
||||
|
||||
#import "HCCollect.h"
|
||||
|
||||
|
||||
static void requireElementsToBeStrings(NSArray *array)
|
||||
{
|
||||
for (id element in array)
|
||||
{
|
||||
if (![element isKindOfClass:[NSString class]])
|
||||
{
|
||||
@throw [NSException exceptionWithName:@"NotAString"
|
||||
reason:@"Arguments must be strings"
|
||||
userInfo:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@interface HCStringContainsInOrder ()
|
||||
@property (nonatomic, copy, readonly) NSArray<NSString *> *substrings;
|
||||
@end
|
||||
|
||||
@implementation HCStringContainsInOrder
|
||||
|
||||
- (instancetype)initWithSubstrings:(NSArray<NSString *> *)substrings
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
requireElementsToBeStrings(substrings);
|
||||
_substrings = [substrings copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)matches:(nullable id)item
|
||||
{
|
||||
if (![item isKindOfClass:[NSString class]])
|
||||
return NO;
|
||||
|
||||
NSRange searchRange = NSMakeRange(0, [item length]);
|
||||
for (NSString *substring in self.substrings)
|
||||
{
|
||||
NSRange substringRange = [item rangeOfString:substring options:0 range:searchRange];
|
||||
if (substringRange.location == NSNotFound)
|
||||
return NO;
|
||||
searchRange.location = substringRange.location + substringRange.length;
|
||||
searchRange.length = [item length] - searchRange.location;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)describeTo:(id <HCDescription>)description
|
||||
{
|
||||
[description appendList:self.substrings start:@"a string containing " separator:@", " end:@" in order"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
id HC_stringContainsInOrderIn(NSArray<NSString *> *substrings)
|
||||
{
|
||||
return [[HCStringContainsInOrder alloc] initWithSubstrings:substrings];
|
||||
}
|
||||
|
||||
id HC_stringContainsInOrder(NSString *substrings, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, substrings);
|
||||
NSArray *array = HCCollectItems(substrings, args);
|
||||
va_end(args);
|
||||
|
||||
return HC_stringContainsInOrderIn(array);
|
||||
}
|
||||
40
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringEndsWith.h
generated
Normal file
40
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringEndsWith.h
generated
Normal file
@@ -0,0 +1,40 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import <OCHamcrest/HCSubstringMatcher.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @abstract Tests if string ends with a substring.
|
||||
*/
|
||||
@interface HCStringEndsWith : HCSubstringMatcher
|
||||
@end
|
||||
|
||||
|
||||
FOUNDATION_EXPORT id HC_endsWith(NSString *suffix);
|
||||
|
||||
#ifndef HC_DISABLE_SHORT_SYNTAX
|
||||
/*!
|
||||
* @abstract Creates a matcher that matches when the examined object is a string that ends with the
|
||||
* specified string.
|
||||
* @param suffix The substring that the returned matcher will expect at the end of any examined
|
||||
* string. (Must not be <code>nil</code>.)
|
||||
* @discussion The matcher invokes <code>-hasSuffix:</code> on the examined object, passing the
|
||||
* specified <em>suffix</em>.
|
||||
*
|
||||
* <b>Example</b><br />
|
||||
* <pre>assertThat(\@"myStringOfNote", endsWith(\@"Note"))</pre>
|
||||
*
|
||||
* <b>Name Clash</b><br />
|
||||
* In the event of a name clash, <code>#define HC_DISABLE_SHORT_SYNTAX</code> and use the synonym
|
||||
* HC_endsWith instead.
|
||||
*/
|
||||
static inline id endsWith(NSString *suffix)
|
||||
{
|
||||
return HC_endsWith(suffix);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
28
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringEndsWith.m
generated
Normal file
28
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringEndsWith.m
generated
Normal file
@@ -0,0 +1,28 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import "HCStringEndsWith.h"
|
||||
|
||||
|
||||
@implementation HCStringEndsWith
|
||||
|
||||
- (BOOL)matches:(nullable id)item
|
||||
{
|
||||
if (![item respondsToSelector:@selector(hasSuffix:)])
|
||||
return NO;
|
||||
|
||||
return [item hasSuffix:self.substring];
|
||||
}
|
||||
|
||||
- (NSString *)relationship
|
||||
{
|
||||
return @"ending with";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
id HC_endsWith(NSString *suffix)
|
||||
{
|
||||
return [[HCStringEndsWith alloc] initWithSubstring:suffix];
|
||||
}
|
||||
40
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringStartsWith.h
generated
Normal file
40
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringStartsWith.h
generated
Normal file
@@ -0,0 +1,40 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import <OCHamcrest/HCSubstringMatcher.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @abstract Tests string starts with a substring.
|
||||
*/
|
||||
@interface HCStringStartsWith : HCSubstringMatcher
|
||||
@end
|
||||
|
||||
|
||||
FOUNDATION_EXPORT id HC_startsWith(NSString *prefix);
|
||||
|
||||
#ifndef HC_DISABLE_SHORT_SYNTAX
|
||||
/*!
|
||||
* @abstract Creates a matcher that matches when the examined object is a string that starts with
|
||||
* the specified string.
|
||||
* @param prefix The substring that the returned matcher will expect at the start of any examined
|
||||
* string. (Must not be <code>nil</code>.)
|
||||
* @discussion The matcher invokes <code>-hasPrefix:</code> on the examined object, passing the
|
||||
* specified <em>prefix</em>.
|
||||
*
|
||||
* <b>Example</b><br />
|
||||
* <pre>assertThat(\@"myStringOfNote", startsWith(\@"my"))</pre>
|
||||
*
|
||||
* <b>Name Clash</b><br />
|
||||
* In the event of a name clash, <code>#define HC_DISABLE_SHORT_SYNTAX</code> and use the synonym
|
||||
* HC_startsWith instead.
|
||||
*/
|
||||
static inline id startsWith(NSString *prefix)
|
||||
{
|
||||
return HC_startsWith(prefix);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
28
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringStartsWith.m
generated
Normal file
28
iOS/Pods/OCHamcrest/Source/Library/Text/HCStringStartsWith.m
generated
Normal file
@@ -0,0 +1,28 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import "HCStringStartsWith.h"
|
||||
|
||||
|
||||
@implementation HCStringStartsWith
|
||||
|
||||
- (BOOL)matches:(nullable id)item
|
||||
{
|
||||
if (![item respondsToSelector:@selector(hasPrefix:)])
|
||||
return NO;
|
||||
|
||||
return [item hasPrefix:self.substring];
|
||||
}
|
||||
|
||||
- (NSString *)relationship
|
||||
{
|
||||
return @"starting with";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
id HC_startsWith(NSString *prefix)
|
||||
{
|
||||
return [[HCStringStartsWith alloc] initWithSubstring:prefix];
|
||||
}
|
||||
18
iOS/Pods/OCHamcrest/Source/Library/Text/HCSubstringMatcher.h
generated
Normal file
18
iOS/Pods/OCHamcrest/Source/Library/Text/HCSubstringMatcher.h
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import <OCHamcrest/HCBaseMatcher.h>
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface HCSubstringMatcher : HCBaseMatcher
|
||||
|
||||
@property (nonatomic, copy, readonly) NSString *substring;
|
||||
|
||||
- (instancetype)initWithSubstring:(NSString *)substring NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
34
iOS/Pods/OCHamcrest/Source/Library/Text/HCSubstringMatcher.m
generated
Normal file
34
iOS/Pods/OCHamcrest/Source/Library/Text/HCSubstringMatcher.m
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
// OCHamcrest by Jon Reid, https://qualitycoding.org/
|
||||
// Copyright 2019 hamcrest.org. See LICENSE.txt
|
||||
|
||||
#import "HCSubstringMatcher.h"
|
||||
|
||||
#import "HCRequireNonNilObject.h"
|
||||
|
||||
|
||||
@interface HCSubstringMatcher (SubclassResponsibility)
|
||||
- (NSString *)relationship;
|
||||
@end
|
||||
|
||||
|
||||
@implementation HCSubstringMatcher
|
||||
|
||||
- (instancetype)initWithSubstring:(NSString *)substring
|
||||
{
|
||||
HCRequireNonNilObject(substring);
|
||||
|
||||
self = [super init];
|
||||
if (self)
|
||||
_substring = [substring copy];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)describeTo:(id <HCDescription>)description
|
||||
{
|
||||
[[[[description appendText:@"a string "]
|
||||
appendText:[self relationship]]
|
||||
appendText:@" "]
|
||||
appendDescriptionOf:self.substring];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user