forked from Quick/Quick
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
267 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule Nimble
updated
77 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
import Foundation | ||
import XCTest | ||
|
||
// NOTE: This file is not intended to be included in the Xcode project or CocoaPods. | ||
// It is picked up by the Swift Package Manager during its build process. | ||
|
||
open class QuickConfiguration { | ||
#if SWIFT_PACKAGE | ||
|
||
open class QuickConfiguration: NSObject { | ||
open class func configure(_ configuration: Configuration) {} | ||
} | ||
|
||
#if _runtime(_ObjC) | ||
|
||
internal func qck_enumerateSubclasses<T: AnyObject>(_ klass: T.Type, block: (T.Type) -> Void) { | ||
var classesCount = objc_getClassList(nil, 0) | ||
|
||
guard classesCount > 0 else { | ||
return | ||
} | ||
|
||
let classes = UnsafeMutablePointer<AnyClass?>.allocate(capacity: Int(classesCount)) | ||
classesCount = objc_getClassList(AutoreleasingUnsafeMutablePointer(classes), classesCount) | ||
|
||
var subclass, superclass: AnyClass! | ||
for i in 0..<classesCount { | ||
subclass = classes[Int(i)] | ||
superclass = class_getSuperclass(subclass) | ||
if superclass === klass { | ||
block(subclass as! T.Type) // swiftlint:disable:this force_cast | ||
} | ||
} | ||
|
||
free(classes) | ||
} | ||
|
||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#import "QuickSpecBase.h" | ||
|
||
#pragma mark - _SelectorWrapper | ||
|
||
@interface _SelectorWrapper () | ||
@property(nonatomic, assign) SEL selector; | ||
@end | ||
|
||
@implementation _SelectorWrapper | ||
|
||
- (instancetype)initWithSelector:(SEL)selector { | ||
self = [super init]; | ||
_selector = selector; | ||
return self; | ||
} | ||
|
||
@end | ||
|
||
|
||
#pragma mark - _QuickSpecBase | ||
|
||
@implementation _QuickSpecBase | ||
|
||
- (instancetype)init { | ||
self = [super initWithInvocation: nil]; | ||
return self; | ||
} | ||
|
||
/** | ||
Invocations for each test method in the test case. QuickSpec overrides this method to define a | ||
new method for each example defined in +[QuickSpec spec]. | ||
@return An array of invocations that execute the newly defined example methods. | ||
*/ | ||
+ (NSArray<NSInvocation *> *)testInvocations { | ||
NSArray<_SelectorWrapper *> *wrappers = [self _testMethodSelectors]; | ||
NSMutableArray<NSInvocation *> *invocations = [NSMutableArray arrayWithCapacity:wrappers.count]; | ||
|
||
for (_SelectorWrapper *wrapper in wrappers) { | ||
SEL selector = wrapper.selector; | ||
NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; | ||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; | ||
invocation.selector = selector; | ||
|
||
[invocations addObject:invocation]; | ||
} | ||
|
||
return invocations; | ||
} | ||
|
||
+ (NSArray<_SelectorWrapper *> *)_testMethodSelectors { | ||
return @[]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@import Foundation; | ||
@import XCTest; | ||
|
||
@interface _SelectorWrapper : NSObject | ||
- (instancetype)initWithSelector:(SEL)selector; | ||
@end | ||
|
||
@interface _QuickSpecBase : XCTestCase | ||
+ (NSArray<_SelectorWrapper *> *)_testMethodSelectors; | ||
- (instancetype)init NS_DESIGNATED_INITIALIZER; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.