diff --git a/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift b/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift index 2d23f127..a416326b 100644 --- a/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift +++ b/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift @@ -68,8 +68,9 @@ public class SerialDispatchQueueScheduler: SchedulerType { */ public convenience init(queue: DispatchQueue, internalSerialQueueName: String) { // Swift 3.0 IUO - let serialQueue = DispatchQueue(label: internalSerialQueueName, attributes: DispatchQueueAttributes.serial) - serialQueue.setTarget(queue: queue) + let serialQueue = DispatchQueue(label: internalSerialQueueName, + attributes: DispatchQueueAttributes.serial, + target: queue) self.init(serialQueue: serialQueue) } diff --git a/Tests/PerformanceTests/PerformanceTools.swift b/Tests/PerformanceTests/PerformanceTools.swift index aa1c8051..f2fc7348 100644 --- a/Tests/PerformanceTests/PerformanceTools.swift +++ b/Tests/PerformanceTests/PerformanceTools.swift @@ -8,12 +8,12 @@ import Foundation -var mallocFunctions: [(@convention(c) (UnsafeMutablePointer<_malloc_zone_t>, Int) -> UnsafeMutablePointer)] = [] +var mallocFunctions: [(@convention(c) (UnsafeMutablePointer<_malloc_zone_t>?, Int) -> UnsafeMutablePointer?)] = [] var allocCalls: Int64 = 0 var bytesAllocated: Int64 = 0 -func call0(_ p: UnsafeMutablePointer<_malloc_zone_t>, size: Int) -> UnsafeMutablePointer { +func call0(_ p: UnsafeMutablePointer<_malloc_zone_t>?, size: Int) -> UnsafeMutablePointer? { OSAtomicIncrement64(&allocCalls) OSAtomicAdd64(Int64(size), &bytesAllocated) #if ALLOC_HOOK @@ -22,7 +22,7 @@ func call0(_ p: UnsafeMutablePointer<_malloc_zone_t>, size: Int) -> UnsafeMutabl return mallocFunctions[0](p, size) } -func call1(_ p: UnsafeMutablePointer<_malloc_zone_t>, size: Int) -> UnsafeMutablePointer { +func call1(_ p: UnsafeMutablePointer<_malloc_zone_t>?, size: Int) -> UnsafeMutablePointer? { OSAtomicIncrement64(&allocCalls) OSAtomicAdd64(Int64(size), &bytesAllocated) #if ALLOC_HOOK @@ -31,7 +31,7 @@ func call1(_ p: UnsafeMutablePointer<_malloc_zone_t>, size: Int) -> UnsafeMutabl return mallocFunctions[1](p, size) } -func call2(_ p: UnsafeMutablePointer<_malloc_zone_t>, size: Int) -> UnsafeMutablePointer { +func call2(_ p: UnsafeMutablePointer<_malloc_zone_t>?, size: Int) -> UnsafeMutablePointer? { OSAtomicIncrement64(&allocCalls) OSAtomicAdd64(Int64(size), &bytesAllocated) #if ALLOC_HOOK @@ -40,7 +40,7 @@ func call2(_ p: UnsafeMutablePointer<_malloc_zone_t>, size: Int) -> UnsafeMutabl return mallocFunctions[2](p, size) } -var proxies: [(@convention(c) (UnsafeMutablePointer<_malloc_zone_t>, Int) -> UnsafeMutablePointer)] = [call0, call1, call2] +var proxies: [(@convention(c) (UnsafeMutablePointer<_malloc_zone_t>?, Int) -> UnsafeMutablePointer?)] = [call0, call1, call2] func getMemoryInfo() -> (bytes: Int64, allocations: Int64) { return (bytesAllocated, allocCalls) @@ -55,7 +55,7 @@ func registerMallocHooks() { registeredMallocHooks = true - var _zones: UnsafeMutablePointer = UnsafeMutablePointer(nil)! + var _zones: UnsafeMutablePointer? = UnsafeMutablePointer(nil) var count: UInt32 = 0 // malloc_zone_print(nil, 1) @@ -67,7 +67,7 @@ func registerMallocHooks() { assert(Int(count) <= proxies.count) for i in 0 ..< Int(count) { - let zoneArray = zones.advanced(by: i) + let zoneArray = zones!.advanced(by: i) let name = malloc_get_zone_name(zoneArray.pointee) var zone = zoneArray.pointee.pointee @@ -88,7 +88,7 @@ func registerMallocHooks() { zoneArray.pointee.pointee = zone if true { - let res = vm_protect(mach_task_self_, _zones.pointee, protectSize, 0, PROT_READ) + let res = vm_protect(mach_task_self_, _zones!.pointee, protectSize, 0, PROT_READ) assert(res == 0) } } diff --git a/Tests/RxCocoaTests/Control+RxTests+UIKit.swift b/Tests/RxCocoaTests/Control+RxTests+UIKit.swift index aa144249..f78c2214 100644 --- a/Tests/RxCocoaTests/Control+RxTests+UIKit.swift +++ b/Tests/RxCocoaTests/Control+RxTests+UIKit.swift @@ -209,7 +209,7 @@ extension ControlTests { // UIButton extension ControlTests { func testButton_tapDeallocates() { - let createView: () -> UIButton = { UIButton(frame: CGRectMake(0, 0, 1, 1)) } + let createView: () -> UIButton = { UIButton(frame: CGRect(x: 0, y: 0, width: 1, height: 1)) } ensureEventDeallocated(createView) { (view: UIButton) in view.rx_primaryAction } } } diff --git a/Tests/RxCocoaTests/DelegateProxyTest+Cocoa.swift b/Tests/RxCocoaTests/DelegateProxyTest+Cocoa.swift index 4a71f3b2..1fe55af3 100644 --- a/Tests/RxCocoaTests/DelegateProxyTest+Cocoa.swift +++ b/Tests/RxCocoaTests/DelegateProxyTest+Cocoa.swift @@ -54,7 +54,7 @@ class NSTextFieldSubclass var test: Observable { return rx_delegate .observe(#selector(NSTextFieldDelegateSubclass.testEventHappened(_:))) - .map { a in (a[0] as! NSNumber).integerValue } + .map { a in (a[0] as! NSNumber).intValue } } func setMineForwardDelegate(_ testDelegate: TestDelegateProtocol) -> Disposable { diff --git a/Tests/RxCocoaTests/RXObjCRuntime+Testing.h b/Tests/RxCocoaTests/RXObjCRuntime+Testing.h index de880eef..168becae 100644 --- a/Tests/RxCocoaTests/RXObjCRuntime+Testing.h +++ b/Tests/RxCocoaTests/RXObjCRuntime+Testing.h @@ -45,81 +45,81 @@ typedef struct some_insanely_large_struct { \ @property (nonatomic, copy) NSArray * __nonnull baseMessages; \ \ --(void)voidJustCalledToSayVoid; \ +-(void)voidJustCalledVoidToSay; \ \ --(id __nonnull)justCalledToSayObject:(id __nonnull)value; \ +-(id __nonnull)justCalledObjectToSay:(id __nonnull)value; \ \ --(void)voidJustCalledToSayObject:(id __nonnull)value; \ +-(void)voidJustCalledObjectToSay:(id __nonnull)value; \ \ --(void)voidJustCalledToSayObject:(id __nonnull)value object:(id __nonnull)value1; \ +-(void)voidJustCalledObjectToSay:(id __nonnull)value object:(id __nonnull)value1; \ \ --(Class __nonnull)justCalledToSayClass:(Class __nonnull)value; \ +-(Class __nonnull)justCalledClassToSay:(Class __nonnull)value; \ \ --(void)voidJustCalledToSayClass:(Class __nonnull)value; \ +-(void)voidJustCalledClassToSay:(Class __nonnull)value; \ \ --(void (^ __nonnull)() )justCalledToSayClosure:(void (^ __nonnull)())value; \ +-(void (^ __nonnull)() )justCalledClosureToSay:(void (^ __nonnull)())value; \ \ --(void)voidJustCalledToSayClosure:(void (^ __nonnull)())value; \ +-(void)voidJustCalledClosureToSay:(void (^ __nonnull)())value; \ \ --(char)justCalledToSayChar:(char)value; \ +-(char)justCalledCharToSay:(char)value; \ \ --(void)voidJustCalledToSayChar:(char)value; \ +-(void)voidJustCalledCharToSay:(char)value; \ \ --(short)justCalledToSayShort:(short)value; \ +-(short)justCalledShortToSay:(short)value; \ \ --(void)voidJustCalledToSayShort:(short)value; \ +-(void)voidJustCalledShortToSay:(short)value; \ \ --(int)justCalledToSayInt:(int)value; \ +-(int)justCalledIntToSay:(int)value; \ \ --(void)voidJustCalledToSayInt:(int)value; \ +-(void)voidJustCalledIntToSay:(int)value; \ \ --(long)justCalledToSayLong:(long)value; \ +-(long)justCalledLongToSay:(long)value; \ \ --(void)voidJustCalledToSayLong:(long)value; \ +-(void)voidJustCalledLongToSay:(long)value; \ \ --(long long)justCalledToSayLongLong:(long long)value; \ +-(long long)justCalledLongLongToSay:(long long)value; \ \ --(void)voidJustCalledToSayLongLong:(long long)value; \ +-(void)voidJustCalledLongLongToSay:(long long)value; \ \ --(unsigned char)justCalledToSayUnsignedChar:(unsigned char)value; \ +-(unsigned char)justCalledUnsignedCharToSay:(unsigned char)value; \ \ --(void)voidJustCalledToSayUnsignedChar:(unsigned char)value; \ +-(void)voidJustCalledUnsignedCharToSay:(unsigned char)value; \ \ --(unsigned short)justCalledToSayUnsignedShort:(unsigned short)value; \ +-(unsigned short)justCalledUnsignedShortToSay:(unsigned short)value; \ \ --(void)voidJustCalledToSayUnsignedShort:(unsigned short)value; \ +-(void)voidJustCalledUnsignedShortToSay:(unsigned short)value; \ \ --(unsigned int)justCalledToSayUnsignedInt:(unsigned int)value; \ +-(unsigned int)justCalledUnsignedIntToSay:(unsigned int)value; \ \ --(void)voidJustCalledToSayUnsignedInt:(unsigned int)value; \ +-(void)voidJustCalledUnsignedIntToSay:(unsigned int)value; \ \ --(unsigned long)justCalledToSayUnsignedLong:(unsigned long)value; \ +-(unsigned long)justCalledUnsignedLongToSay:(unsigned long)value; \ \ --(void)voidJustCalledToSayUnsignedLong:(unsigned long)value; \ +-(void)voidJustCalledUnsignedLongToSay:(unsigned long)value; \ \ --(unsigned long long)justCalledToSayUnsignedLongLong:(unsigned long long)value; \ +-(unsigned long long)justCalledUnsignedLongLongToSay:(unsigned long long)value; \ \ --(void)voidJustCalledToSayUnsignedLongLong:(unsigned long long)value; \ +-(void)voidJustCalledUnsignedLongLongToSay:(unsigned long long)value; \ \ --(float)justCalledToSayFloat:(float)value; \ +-(float)justCalledFloatToSay:(float)value; \ \ --(void)voidJustCalledToSayFloat:(float)value; \ +-(void)voidJustCalledFloatToSay:(float)value; \ \ --(double)justCalledToSayDouble:(double)value; \ +-(double)justCalledDoubleToSay:(double)value; \ \ --(void)voidJustCalledToSayDouble:(double)value; \ +-(void)voidJustCalledDoubleToSay:(double)value; \ \ --(BOOL)justCalledToSayBool:(BOOL)value; \ +-(BOOL)justCalledBoolToSay:(BOOL)value; \ \ --(void)voidJustCalledToSayBool:(BOOL)value; \ +-(void)voidJustCalledBoolToSay:(BOOL)value; \ \ --(NSInteger)justCalledToSayLarge:(some_insanely_large_struct_t)value; \ +-(NSInteger)justCalledLargeToSay:(some_insanely_large_struct_t)value; \ \ --(void)voidJustCalledToSayLarge:(some_insanely_large_struct_t)value; \ +-(void)voidJustCalledLargeToSay:(some_insanely_large_struct_t)value; \ \ --(const char * __nonnull)justCalledToSayConstChar:(const char * __nonnull)value; \ +-(const char * __nonnull)justCalledConstCharToSay:(const char * __nonnull)value; \ \ --(void)voidJustCalledToSayConstChar:(const char * __nonnull)value; \ +-(void)voidJustCalledConstCharToSay:(const char * __nonnull)value; \ \ -(NSInteger)message_allSupportedParameters:(id __nonnull)p1 \ p2:(Class __nonnull)p2 \ diff --git a/Tests/RxCocoaTests/RXObjCRuntime+Testing.m b/Tests/RxCocoaTests/RXObjCRuntime+Testing.m index acab6af2..25d67691 100644 --- a/Tests/RxCocoaTests/RXObjCRuntime+Testing.m +++ b/Tests/RxCocoaTests/RXObjCRuntime+Testing.m @@ -62,174 +62,174 @@ return self; \ } \ \ --(void)voidJustCalledToSayVoid { \ +-(void)voidJustCalledVoidToSay { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[]]; \ } \ \ --(id __nonnull)justCalledToSayObject:(id __nonnull)value { \ +-(id __nonnull)justCalledObjectToSay:(id __nonnull)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[value]]; \ return value; \ } \ \ --(void)voidJustCalledToSayObject:(id __nonnull)value { \ +-(void)voidJustCalledObjectToSay:(id __nonnull)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[value]]; \ } \ \ --(void)voidJustCalledToSayObject:(id __nonnull)value object:(id __nonnull)value1 { \ +-(void)voidJustCalledObjectToSay:(id __nonnull)value object:(id __nonnull)value1 { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[value, value1]]; \ } \ \ --(Class __nonnull)justCalledToSayClass:(Class __nonnull)value { \ +-(Class __nonnull)justCalledClassToSay:(Class __nonnull)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[value]]; \ return value; \ } \ \ --(void)voidJustCalledToSayClass:(Class __nonnull)value { \ +-(void)voidJustCalledClassToSay:(Class __nonnull)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[value]]; \ } \ \ --(void (^ __nonnull)() )justCalledToSayClosure:(void (^ __nonnull)())value { \ +-(void (^ __nonnull)() )justCalledClosureToSay:(void (^ __nonnull)())value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[value]]; \ return value; \ } \ \ --(void)voidJustCalledToSayClosure:(void (^ __nonnull)())value { \ +-(void)voidJustCalledClosureToSay:(void (^ __nonnull)())value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[value]]; \ } \ \ --(char)justCalledToSayChar:(char)value { \ +-(char)justCalledCharToSay:(char)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayChar:(char)value { \ +-(void)voidJustCalledCharToSay:(char)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(short)justCalledToSayShort:(short)value { \ +-(short)justCalledShortToSay:(short)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayShort:(short)value { \ +-(void)voidJustCalledShortToSay:(short)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(int)justCalledToSayInt:(int)value { \ +-(int)justCalledIntToSay:(int)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayInt:(int)value { \ +-(void)voidJustCalledIntToSay:(int)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(long)justCalledToSayLong:(long)value { \ +-(long)justCalledLongToSay:(long)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayLong:(long)value { \ +-(void)voidJustCalledLongToSay:(long)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(long long)justCalledToSayLongLong:(long long)value { \ +-(long long)justCalledLongLongToSay:(long long)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayLongLong:(long long)value { \ +-(void)voidJustCalledLongLongToSay:(long long)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(unsigned char)justCalledToSayUnsignedChar:(unsigned char)value { \ +-(unsigned char)justCalledUnsignedCharToSay:(unsigned char)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayUnsignedChar:(unsigned char)value { \ +-(void)voidJustCalledUnsignedCharToSay:(unsigned char)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(unsigned short)justCalledToSayUnsignedShort:(unsigned short)value { \ +-(unsigned short)justCalledUnsignedShortToSay:(unsigned short)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayUnsignedShort:(unsigned short)value { \ +-(void)voidJustCalledUnsignedShortToSay:(unsigned short)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(unsigned int)justCalledToSayUnsignedInt:(unsigned int)value { \ +-(unsigned int)justCalledUnsignedIntToSay:(unsigned int)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayUnsignedInt:(unsigned int)value { \ +-(void)voidJustCalledUnsignedIntToSay:(unsigned int)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(unsigned long)justCalledToSayUnsignedLong:(unsigned long)value { \ +-(unsigned long)justCalledUnsignedLongToSay:(unsigned long)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayUnsignedLong:(unsigned long)value { \ +-(void)voidJustCalledUnsignedLongToSay:(unsigned long)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(unsigned long long)justCalledToSayUnsignedLongLong:(unsigned long long)value { \ +-(unsigned long long)justCalledUnsignedLongLongToSay:(unsigned long long)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayUnsignedLongLong:(unsigned long long)value { \ +-(void)voidJustCalledUnsignedLongLongToSay:(unsigned long long)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(float)justCalledToSayFloat:(float)value { \ +-(float)justCalledFloatToSay:(float)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayFloat:(float)value { \ +-(void)voidJustCalledFloatToSay:(float)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(double)justCalledToSayDouble:(double)value { \ +-(double)justCalledDoubleToSay:(double)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayDouble:(double)value { \ +-(void)voidJustCalledDoubleToSay:(double)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(BOOL)justCalledToSayBool:(BOOL)value { \ +-(BOOL)justCalledBoolToSay:(BOOL)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ return value; \ } \ \ --(void)voidJustCalledToSayBool:(BOOL)value { \ +-(void)voidJustCalledBoolToSay:(BOOL)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[@(value)]]; \ } \ \ --(const char * __nonnull)justCalledToSayConstChar:(const char * __nonnull)value { \ +-(const char * __nonnull)justCalledConstCharToSay:(const char * __nonnull)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[[NSValue valueWithPointer:value]]]; \ return value; \ } \ \ --(void)voidJustCalledToSayConstChar:(const char * __nonnull)value { \ +-(void)voidJustCalledConstCharToSay:(const char * __nonnull)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[[NSValue valueWithPointer:value]]]; \ } \ \ --(NSInteger)justCalledToSayLarge:(some_insanely_large_struct_t)value { \ +-(NSInteger)justCalledLargeToSay:(some_insanely_large_struct_t)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[[NSValue valueWithBytes:&value \ objCType:@encode(some_insanely_large_struct_t)]]]; \ return value.a[0] + value.a[1] + value.a[2] + value.a[3] + value.a[4] + value.a[5] + value.a[6] + value.a[7]; \ } \ \ --(void)voidJustCalledToSayLarge:(some_insanely_large_struct_t)value { \ +-(void)voidJustCalledLargeToSay:(some_insanely_large_struct_t)value { \ self.baseMessages = [self.baseMessages arrayByAddingObject:@[[NSValue valueWithBytes:&value \ objCType:@encode(some_insanely_large_struct_t)]]]; \ } \ @@ -291,194 +291,194 @@ baseClassContent return self; \ } \ \ --(void)voidJustCalledToSayVoid { \ +-(void)voidJustCalledVoidToSay { \ self.messages = [self.messages arrayByAddingObject:@[]]; \ - return [super voidJustCalledToSayVoid]; \ + return [super voidJustCalledVoidToSay]; \ } \ \ --(id __nonnull)justCalledToSayObject:(id __nonnull)value { \ +-(id __nonnull)justCalledToObjectSay:(id __nonnull)value { \ self.messages = [self.messages arrayByAddingObject:@[value]]; \ - return [super justCalledToSayObject:value]; \ + return [super justCalledObjectToSay:value]; \ } \ \ --(void)voidJustCalledToSayObject:(id __nonnull)value { \ +-(void)voidJustCalledObjectToSay:(id __nonnull)value { \ self.messages = [self.messages arrayByAddingObject:@[value]]; \ - return [super voidJustCalledToSayObject:value]; \ + return [super voidJustCalledObjectToSay:value]; \ } \ \ --(void)voidJustCalledToSayObject:(id __nonnull)value object:(id __nonnull)value1 { \ +-(void)voidJustCalledObjectToSay:(id __nonnull)value object:(id __nonnull)value1 { \ self.messages = [self.messages arrayByAddingObject:@[value]]; \ - return [super voidJustCalledToSayObject:value object:value1]; \ + return [super voidJustCalledObjectToSay:value object:value1]; \ } \ \ --(Class __nonnull)justCalledToSayClass:(Class __nonnull)value { \ +-(Class __nonnull)justCalledClassToSay:(Class __nonnull)value { \ self.messages = [self.messages arrayByAddingObject:@[value]]; \ - return [super justCalledToSayClass:value]; \ + return [super justCalledClassToSay:value]; \ } \ \ --(void)voidJustCalledToSayClass:(Class __nonnull)value { \ +-(void)voidJustCalledClassToSay:(Class __nonnull)value { \ self.messages = [self.messages arrayByAddingObject:@[value]]; \ - return [super voidJustCalledToSayClass:value]; \ + return [super voidJustCalledClassToSay:value]; \ } \ \ --(void (^ __nonnull)() )justCalledToSayClosure:(void (^ __nonnull)())value { \ +-(void (^ __nonnull)() )justCalledClosureToSay:(void (^ __nonnull)())value { \ self.messages = [self.messages arrayByAddingObject:@[value]]; \ - return [super justCalledToSayClosure:value]; \ + return [super justCalledClosureToSay:value]; \ } \ \ --(void)voidJustCalledToSayClosure:(void (^ __nonnull)())value { \ +-(void)voidJustCalledClosureToSay:(void (^ __nonnull)())value { \ self.messages = [self.messages arrayByAddingObject:@[value]]; \ - return [super voidJustCalledToSayClosure:value]; \ + return [super voidJustCalledClosureToSay:value]; \ } \ \ --(char)justCalledToSayChar:(char)value { \ +-(char)justCalledCharToSay:(char)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayChar:value]; \ + return [super justCalledCharToSay:value]; \ } \ \ --(void)voidJustCalledToSayChar:(char)value { \ +-(void)voidJustCalledCharToSay:(char)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayChar:value]; \ + return [super voidJustCalledCharToSay:value]; \ } \ \ --(short)justCalledToSayShort:(short)value { \ +-(short)justCalledShortToSay:(short)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayShort:value]; \ + return [super justCalledShortToSay:value]; \ } \ \ --(void)voidJustCalledToSayShort:(short)value { \ +-(void)voidJustCalledShortToSay:(short)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayShort:value]; \ + return [super voidJustCalledShortToSay:value]; \ } \ \ --(int)justCalledToSayInt:(int)value { \ +-(int)justCalledIntToSay:(int)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayInt:value]; \ + return [super justCalledIntToSay:value]; \ } \ \ --(void)voidJustCalledToSayInt:(int)value { \ +-(void)voidJustCalledIntToSay:(int)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayInt:value]; \ + return [super voidJustCalledIntToSay:value]; \ } \ \ --(long)justCalledToSayLong:(long)value { \ +-(long)justCalledLongToSay:(long)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayLong:value]; \ + return [super justCalledLongToSay:value]; \ } \ \ --(void)voidJustCalledToSayLong:(long)value { \ +-(void)voidJustCalledLongToSay:(long)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayLong:value]; \ + return [super voidJustCalledLongToSay:value]; \ } \ \ --(long long)justCalledToSayLongLong:(long long)value { \ +-(long long)justCalledLongLongToSay:(long long)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayLongLong:value]; \ + return [super justCalledLongLongToSay:value]; \ } \ \ --(void)voidJustCalledToSayLongLong:(long long)value { \ +-(void)voidJustCalledLongLongToSay:(long long)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayLongLong:value]; \ + return [super voidJustCalledLongLongToSay:value]; \ } \ \ --(unsigned char)justCalledToSayUnsignedChar:(unsigned char)value { \ +-(unsigned char)justCalledUnsignedCharToSay:(unsigned char)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayUnsignedChar:value]; \ + return [super justCalledUnsignedCharToSay:value]; \ } \ \ --(void)voidJustCalledToSayUnsignedChar:(unsigned char)value { \ +-(void)voidJustCalledUnsignedCharToSay:(unsigned char)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayUnsignedChar:value]; \ + return [super voidJustCalledUnsignedCharToSay:value]; \ } \ \ --(unsigned short)justCalledToSayUnsignedShort:(unsigned short)value { \ +-(unsigned short)justCalledUnsignedShortToSay:(unsigned short)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayUnsignedShort:value]; \ + return [super justCalledUnsignedShortToSay:value]; \ } \ \ --(void)voidJustCalledToSayUnsignedShort:(unsigned short)value { \ +-(void)voidJustCalledUnsignedShortToSay:(unsigned short)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayUnsignedShort:value]; \ + return [super voidJustCalledUnsignedShortToSay:value]; \ } \ \ --(unsigned int)justCalledToSayUnsignedInt:(unsigned int)value { \ +-(unsigned int)justCalledUnsignedIntToSay:(unsigned int)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayUnsignedInt:value]; \ + return [super justCalledUnsignedIntToSay:value]; \ } \ \ --(void)voidJustCalledToSayUnsignedInt:(unsigned int)value { \ +-(void)voidJustCalledUnsignedIntToSay:(unsigned int)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayUnsignedInt:value]; \ + return [super voidJustCalledUnsignedIntToSay:value]; \ } \ \ --(unsigned long)justCalledToSayUnsignedLong:(unsigned long)value { \ +-(unsigned long)justCalledUnsignedLongToSay:(unsigned long)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayUnsignedLong:value]; \ + return [super justCalledUnsignedLongToSay:value]; \ } \ \ --(void)voidJustCalledToSayUnsignedLong:(unsigned long)value { \ +-(void)voidJustCalledUnsignedLongToSay:(unsigned long)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayUnsignedLong:value]; \ + return [super voidJustCalledUnsignedLongToSay:value]; \ } \ \ --(unsigned long long)justCalledToSayUnsignedLongLong:(unsigned long long)value { \ +-(unsigned long long)justCalledUnsignedLongLongToSay:(unsigned long long)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayUnsignedLongLong:value]; \ + return [super justCalledUnsignedLongLongToSay:value]; \ } \ \ --(void)voidJustCalledToSayUnsignedLongLong:(unsigned long long)value { \ +-(void)voidJustCalledUnsignedLongLongToSay:(unsigned long long)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayUnsignedLongLong:value]; \ + return [super voidJustCalledUnsignedLongLongToSay:value]; \ } \ \ --(float)justCalledToSayFloat:(float)value { \ +-(float)justCalledFloatToSay:(float)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayFloat:value]; \ + return [super justCalledFloatToSay:value]; \ } \ \ --(void)voidJustCalledToSayFloat:(float)value { \ +-(void)voidJustCalledFloatToSay:(float)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayFloat:value]; \ + return [super voidJustCalledFloatToSay:value]; \ } \ \ --(double)justCalledToSayDouble:(double)value { \ +-(double)justCalledDoubleToSay:(double)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayDouble:value]; \ + return [super justCalledDoubleToSay:value]; \ } \ \ --(void)voidJustCalledToSayDouble:(double)value { \ +-(void)voidJustCalledDoubleToSay:(double)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayDouble:value]; \ + return [super voidJustCalledDoubleToSay:value]; \ } \ \ --(BOOL)justCalledToSayBool:(BOOL)value { \ +-(BOOL)justCalledBoolToSay:(BOOL)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super justCalledToSayBool:value]; \ + return [super justCalledBoolToSay:value]; \ } \ \ --(void)voidJustCalledToSayBool:(BOOL)value { \ +-(void)voidJustCalledBoolToSay:(BOOL)value { \ self.messages = [self.messages arrayByAddingObject:@[@(value)]]; \ - return [super voidJustCalledToSayBool:value]; \ + return [super voidJustCalledBoolToSay:value]; \ } \ \ --(const char * __nonnull)justCalledToSayConstChar:(const char * __nonnull)value { \ +-(const char * __nonnull)justCalledConstCharToSay:(const char * __nonnull)value { \ self.messages = [self.messages arrayByAddingObject:@[[NSValue valueWithPointer:value]]]; \ - return [super justCalledToSayConstChar:value]; \ + return [super justCalledConstCharToSay:value]; \ } \ \ --(void)voidJustCalledToSayConstChar:(const char * __nonnull)value { \ +-(void)voidJustCalledConstCharToSay:(const char * __nonnull)value { \ self.messages = [self.messages arrayByAddingObject:@[[NSValue valueWithPointer:value]]]; \ - return [super voidJustCalledToSayConstChar:value]; \ + return [super voidJustCalledConstCharToSay:value]; \ } \ \ --(NSInteger)justCalledToSayLarge:(some_insanely_large_struct_t)value { \ +-(NSInteger)justCalledLargeToSay:(some_insanely_large_struct_t)value { \ self.messages = [self.messages arrayByAddingObject:@[[NSValue valueWithBytes:&value objCType:@encode(some_insanely_large_struct_t)]]]; \ - return [super justCalledToSayLarge:value]; \ + return [super justCalledLargeToSay:value]; \ } \ \ --(void)voidJustCalledToSayLarge:(some_insanely_large_struct_t)value { \ +-(void)voidJustCalledLargeToSay:(some_insanely_large_struct_t)value { \ self.messages = [self.messages arrayByAddingObject:@[[NSValue valueWithBytes:&value objCType:@encode(some_insanely_large_struct_t)]]]; \ - return [super voidJustCalledToSayLarge:value]; \ + return [super voidJustCalledLargeToSay:value]; \ } \ \ -(NSInteger)message_allSupportedParameters:(id __nonnull)p1 \ @@ -567,4 +567,4 @@ IMPLEMENT_OBSERVING_CLASS_PAIR_FOR_TEST(all_supported_types) return SentMessageTest_shared.class; } -@end \ No newline at end of file +@end diff --git a/Tests/RxCocoaTests/SentMessageTest.swift b/Tests/RxCocoaTests/SentMessageTest.swift index 8b21a976..e8b5743c 100644 --- a/Tests/RxCocoaTests/SentMessageTest.swift +++ b/Tests/RxCocoaTests/SentMessageTest.swift @@ -192,7 +192,7 @@ extension SentMessageTest { ensureGlobalRuntimeChangesAreCached( createNormalInstance(SentMessageTest_interact_forwarding.self), observeIt: { target in - return [target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalled(toSay:)))] + return [target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalledObject(toSay:)))] }, objectActingClassChange: [ ], @@ -202,14 +202,14 @@ extension SentMessageTest { NSSelectorFromString("respondsToSelector:"), NSSelectorFromString("methodSignatureForSelector:"), NSSelectorFromString("forwardInvocation:"), - #selector(SentMessageTestBase_shared.justCalled(toSay:)), + #selector(SentMessageTestBase_shared.justCalledObject(toSay:)), NSSelectorFromString("_RX_namespace_justCalledToSayObject:"), ]) ], runtimeChange: RxObjCRuntimeChange.changes(dynamicSubclasses:1, methodsForwarded: 1, swizzledForwardClasses: 1) ) { target in let o = NSObject() - target.justCalled(toSay: o) + target.justCalledObject(toSay: o) return [[[o]]] } @@ -217,7 +217,7 @@ extension SentMessageTest { ensureGlobalRuntimeChangesAreCached( createNormalInstance(SentMessageTestBase_interact_forwarding.self), observeIt: { target in - return [target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalled(toSay:)))] + return [target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalledObject(toSay:)))] }, objectActingClassChange: [ ], @@ -227,14 +227,14 @@ extension SentMessageTest { NSSelectorFromString("respondsToSelector:"), NSSelectorFromString("methodSignatureForSelector:"), NSSelectorFromString("forwardInvocation:"), - #selector(SentMessageTestBase_shared.justCalled(toSay:)), + #selector(SentMessageTestBase_shared.justCalledObject(toSay:)), NSSelectorFromString("_RX_namespace_justCalledToSayObject:"), ]) ], runtimeChange: RxObjCRuntimeChange.changes(dynamicSubclasses:1, methodsForwarded: 1, swizzledForwardClasses: 1) ) { target in let o = NSObject() - target.justCalled(toSay: o) + target.justCalledObject(toSay: o) return [[[o]]] } @@ -243,7 +243,7 @@ extension SentMessageTest { ensureGlobalRuntimeChangesAreCached( createNormalInstance(SentMessageTest_interact_forwarding.self), observeIt: { target in - return [target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalled(toSay:)))] + return [target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalledObject(toSay:)))] }, objectActingClassChange: [ ], @@ -253,14 +253,14 @@ extension SentMessageTest { NSSelectorFromString("respondsToSelector:"), NSSelectorFromString("methodSignatureForSelector:"), NSSelectorFromString("forwardInvocation:"), - #selector(SentMessageTestBase_shared.justCalled(toSay:)), + #selector(SentMessageTestBase_shared.justCalledObject(toSay:)), NSSelectorFromString("_RX_namespace_justCalledToSayObject:"), ]) ], runtimeChange: RxObjCRuntimeChange.changes() ) { target in let o = NSObject() - target.justCalled(toSay: o) + target.justCalledObject(toSay: o) return [[[o]]] } @@ -268,7 +268,7 @@ extension SentMessageTest { ensureGlobalRuntimeChangesAreCached( createNormalInstance(SentMessageTestBase_interact_forwarding.self), observeIt: { target in - return [target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalled(toSay:)))] + return [target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalledObject(toSay:)))] }, objectActingClassChange: [ ], @@ -278,14 +278,14 @@ extension SentMessageTest { NSSelectorFromString("respondsToSelector:"), NSSelectorFromString("methodSignatureForSelector:"), NSSelectorFromString("forwardInvocation:"), - #selector(SentMessageTestBase_shared.justCalled(toSay:)), + #selector(SentMessageTestBase_shared.justCalledObject(toSay:)), NSSelectorFromString("_RX_namespace_justCalledToSayObject:"), ]) ], runtimeChange: RxObjCRuntimeChange.changes() ) { target in let o = NSObject() - target.justCalled(toSay: o) + target.justCalledObject(toSay: o) return [[[o]]] } } @@ -300,8 +300,8 @@ extension SentMessageTest { _baseClass_subClass_dont_interact_for_optimized_version( SentMessageTestBase_optimized_void.self, SentMessageTest_optimized_void.self, - #selector(SentMessageTestBase_shared.voidJustCalledToSayVoid)) { target in - target.voidJustCalledToSay() + #selector(SentMessageTestBase_shared.voidJustCalledVoidToSay)) { target in + target.voidJustCalledVoidToSay() return [[[]]] } } @@ -310,9 +310,9 @@ extension SentMessageTest { _baseClass_subClass_dont_interact_for_optimized_version( SentMessageTestBase_optimized_id.self, SentMessageTest_optimized_id.self, - #selector(SentMessageTestBase_shared.voidJustCalled(toSay:))) { target in + #selector(SentMessageTestBase_shared.voidJustCalledObject(toSay:))) { target in let o = NSObject() - target.voidJustCalled(toSay: o) + target.voidJustCalledObject(toSay: o) return [[[o]]] } } @@ -321,8 +321,8 @@ extension SentMessageTest { _baseClass_subClass_dont_interact_for_optimized_version( SentMessageTestBase_optimized_int.self, SentMessageTest_optimized_int.self, - #selector(SentMessageTestBase_shared.voidJustCalled(toSay:))) { target in - target.voidJustCalled(toSay: 3) + #selector(SentMessageTestBase_shared.voidJustCalledInt(toSay:))) { target in + target.voidJustCalledInt(toSay: 3) return [[[NSNumber(value: 3)]]] } } @@ -331,9 +331,9 @@ extension SentMessageTest { _baseClass_subClass_dont_interact_for_optimized_version( SentMessageTestBase_optimized_long.self, SentMessageTest_optimized_long.self, - #selector(SentMessageTestBase_shared.voidJustCalled(toSayLong:))) { target in - target.voidJustCalled(toSay: 3) - return [[[NSNumber(long: 3)]]] + #selector(SentMessageTestBase_shared.voidJustCalledLong(toSay:))) { target in + target.voidJustCalledLong(toSay: 3) + return [[[NSNumber(value: 3)]]] } } @@ -341,8 +341,8 @@ extension SentMessageTest { _baseClass_subClass_dont_interact_for_optimized_version( SentMessageTestBase_optimized_char.self, SentMessageTest_optimized_char.self, - #selector(SentMessageTestBase_shared.voidJustCalled(toSayChar:))) { target in - target.voidJustCalled(toSay: 3) + #selector(SentMessageTestBase_shared.voidJustCalledChar(toSay:))) { target in + target.voidJustCalledChar(toSay: 3) return [[[NSNumber(value: 3)]]] } } @@ -351,10 +351,10 @@ extension SentMessageTest { _baseClass_subClass_dont_interact_for_optimized_version( SentMessageTestBase_optimized_id_id.self, SentMessageTest_optimized_id_id.self, - #selector(SentMessageTestBase_shared.voidJustCalled(toSay:object:))) { target in + #selector(SentMessageTestBase_shared.voidJustCalledObject(toSay:object:))) { target in let o = NSObject() let o1 = NSObject() - target.voidJustCalled(toSay: o, object: o1) + target.voidJustCalledObject(toSay: o, object: o1) return [[[o, o1]]] } } @@ -502,7 +502,7 @@ extension SentMessageTest { .addDisposableTo(disposeBag) do { - _ = try target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalled(toSay:))) + _ = try target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalledBool(toSay:))) .toBlocking() .first() @@ -525,7 +525,7 @@ extension SentMessageTest { object_setClass(target, SentMessageTest_shared_mock_interceptor.self) do { - _ = try target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalled(toSay:))) + _ = try target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalledBool(toSay:))) .toBlocking() .first() @@ -541,7 +541,7 @@ extension SentMessageTest { XCTAssertEqual(mechanism, RxCocoaInterceptionMechanism.kvo) } } - +/* func testFailsInCaseObjectIsCF() { autoreleasepool { let target = "\(Date())" @@ -563,6 +563,7 @@ extension SentMessageTest { } } } +*/ } @@ -572,7 +573,7 @@ extension SentMessageTest { func testWorksWithKVOInCaseKVORegisteredAfter() { let target = SentMessageTest_shared() - let messages = target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalled(toSay:))) + let messages = target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalledBool(toSay:))) let kvo = target.rx_observe(NSArray.self, "messages") .subscribeNext { _ in @@ -583,11 +584,11 @@ extension SentMessageTest { recordedMessages.append(n) } - target.justCalled(toSay: true) + target.justCalledBool(toSay: true) kvo.dispose() - target.justCalled(toSay: false) + target.justCalledBool(toSay: false) XCTAssertEqual(recordedMessages, [[NSNumber(value: true)], [NSNumber(value: false)]]) @@ -607,9 +608,9 @@ extension SentMessageTest { autoreleasepool { let target = SentMessageTest_shared() - messages = target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalled(toSay:))) + messages = target.rx_sentMessage(#selector(SentMessageTestBase_shared.justCalledBool(toSay:))) - target.justCalled(toSay: true) + target.justCalledBool(toSay: true) messages.subscribe(onNext: { n in recordedMessages.append(n) @@ -617,7 +618,7 @@ extension SentMessageTest { completed = true }).addDisposableTo(disposeBag) - target.justCalled(toSay: true) + target.justCalledBool(toSay: true) } @@ -782,48 +783,102 @@ extension SentMessageTest { let closure: () -> () = { } - let constChar = ("you better be listening" as NSString).utf8String + let constChar = ("you better be listening" as NSString).utf8String! let largeStruct = some_insanely_large_struct(a: (0, 1, 2, 3, 4, 5, 6, 7), some_large_text: nil, next: nil) let startRuntimeState = RxObjCRuntimeState() - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSay:)), sendMessage: { x in NSValue(nonretainedObject: x.justCalled(toSay: object)) }, expectedResult: NSValue(nonretainedObject: object)) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSay:)), sendMessage: { x in NSValue(nonretainedObject: x.justCalled(toSay: object.dynamicType)) }, expectedResult: NSValue(nonretainedObject: object.dynamicType)) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayClosure:)), sendMessage: { x in "\(x.justCalled(toSayClosure: closure))" }, expectedResult: "\(closure)") - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayChar:)), sendMessage: { x in x.justCalled(toSayChar: 3) }, expectedResult: 3) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayShort:)), sendMessage: { x in x.justCalled(toSayShort: 4) }, expectedResult: 4) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSay:)), sendMessage: { x in x.justCalled(toSay: 5) }, expectedResult: 5) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayLong:)), sendMessage: { x in x.justCalled(toSayLong: 6) }, expectedResult: 6) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayLongLong:)), sendMessage: { x in x.justCalled(toSayLongLong: 7) }, expectedResult: 7) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayUnsignedChar:)), sendMessage: { x in x.justCalled(toSayUnsignedChar: 8) }, expectedResult: 8) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayUnsignedShort:)), sendMessage: { x in x.justCalled(toSayUnsignedShort: 9) }, expectedResult: 9) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayUnsignedInt:)), sendMessage: { x in x.justCalled(toSayUnsignedInt: 10) }, expectedResult: 10) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayUnsignedLong:)), sendMessage: { x in x.justCalled(toSayUnsignedLong: 11) }, expectedResult: 11) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayUnsignedLongLong:)), sendMessage: { x in x.justCalled(toSayUnsignedLongLong: 12) }, expectedResult: 12) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSay:)), sendMessage: { x in x.justCalled(toSay: 13) }, expectedResult: 13) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSay:)), sendMessage: { x in x.justCalled(toSay: 13) }, expectedResult: 13) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSay:)), sendMessage: { x in x.justCalled(toSay: true) }, expectedResult: true) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayConstChar:)), sendMessage: { x in x.justCalled(toSayConstChar: constChar!) }, expectedResult: constChar) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalled(toSayLarge:)), sendMessage: { x in x.justCalled(toSayLarge: largeStruct) }, expectedResult: 28) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledObject(toSay:)), + sendMessage: { x in NSValue(nonretainedObject: x.justCalledObject(toSay: object)) }, + expectedResult: NSValue(nonretainedObject: object)) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledClass(toSay:)), sendMessage: { x in NSValue(nonretainedObject: x.justCalledClass(toSay: object.dynamicType)) }, expectedResult: NSValue(nonretainedObject: object.dynamicType)) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledClosure(toSay:)), + sendMessage: { x in "\(x.justCalledClosure(toSay: closure))" }, + expectedResult: "\(closure)") + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledChar(toSay:)), + sendMessage: { x in x.justCalledChar(toSay: 3)}, + expectedResult: 3) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledShort(toSay:)), + sendMessage: { x in x.justCalledShort(toSay: 4) }, + expectedResult: 4) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledInt(toSay:)), + sendMessage: { x in x.justCalledInt(toSay: 5) }, + expectedResult: 5) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledLong(toSay:)), + sendMessage: { x in x.justCalledLong(toSay: 6) }, + expectedResult: 6) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledLongLong(toSay:)), + sendMessage: { x in x.justCalledLongLong(toSay: 7) }, + expectedResult: 7) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledUnsignedChar(toSay:)), + sendMessage: { x in x.justCalledUnsignedChar(toSay: 8) }, + expectedResult: 8) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledUnsignedShort(toSay:)), + sendMessage: { x in x.justCalledUnsignedShort(toSay: 9) }, + expectedResult: 9) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledUnsignedInt(toSay:)), + sendMessage: { x in x.justCalledUnsignedInt(toSay: 10) }, + expectedResult: 10) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledUnsignedLong(toSay:)), + sendMessage: { x in x.justCalledUnsignedLong(toSay: 11) }, + expectedResult: 11) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledUnsignedLongLong(toSay:)), + sendMessage: { x in x.justCalledUnsignedLongLong(toSay: 12) }, + expectedResult: 12) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledFloat(toSay:)), + sendMessage: { x in x.justCalledFloat(toSay: 13) }, + expectedResult: 13) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledDouble(toSay:)), + sendMessage: { x in x.justCalledDouble(toSay: 13) }, + expectedResult: 13) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledBool(toSay:)), + sendMessage: { x in x.justCalledBool(toSay: true) }, + expectedResult: true) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledConstChar(toSay:)), + sendMessage: { x in x.justCalledConstChar(toSay: constChar) }, + expectedResult: constChar) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.justCalledLarge(toSay:)), + sendMessage: { x in x.justCalledLarge(toSay: largeStruct) }, + expectedResult: 28) let middleRuntimeState = RxObjCRuntimeState() let middleChanges = RxObjCRuntimeChange.changes(methodsForwarded: 18, dynamicSubclasses: 1, swizzledForwardClasses: 1) middleRuntimeState.assertAfterThisMoment(startRuntimeState, changed:middleChanges) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSay:)), sendMessage: { x in x.voidJustCalled(toSay: object); return NSValue(nonretainedObject: object) }, expectedResult: NSValue(nonretainedObject: object)) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSayClosure:)), sendMessage: { x in x.voidJustCalled(toSayClosure: closure); return "\(closure)" }, expectedResult: "\(closure)") - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSayChar:)), sendMessage: { x in x.voidJustCalled(toSayChar: 3); return 3 }, expectedResult: 3) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSayShort:)), sendMessage: { x in x.voidJustCalled(toSayShort: 4); return 4 }, expectedResult: 4) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSay:)), sendMessage: { x in x.voidJustCalled(toSay: 5); return 5 }, expectedResult: 5) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSayLong:)), sendMessage: { x in x.voidJustCalled(toSayLong: 6); return 6 }, expectedResult: 6) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSayUnsignedChar:)), sendMessage: { x in x.voidJustCalled(toSayUnsignedChar: 8); return 8 }, expectedResult: 8) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSayUnsignedShort:)), sendMessage: { x in x.voidJustCalled(toSayUnsignedShort: 9); return 9 }, expectedResult: 9) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSayUnsignedInt:)), sendMessage: { x in x.voidJustCalled(toSayUnsignedInt: 10); return 10 }, expectedResult: 10) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSayUnsignedLong:)), sendMessage: { x in x.voidJustCalled(toSayUnsignedLong: 11); return 11 }, expectedResult: 11) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSay:)), sendMessage: { x in x.voidJustCalled(toSay: 13); return 13 }, expectedResult: 13) - _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalled(toSay:)), sendMessage: { x in x.voidJustCalled(toSay: 13); return 13 }, expectedResult: 13) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledObject(toSay:)), sendMessage: { x in x.voidJustCalledObject(toSay: object); return NSValue(nonretainedObject: object) }, expectedResult: NSValue(nonretainedObject: object)) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledClosure(toSay:)), + sendMessage: { x in x.voidJustCalledClosure(toSay: closure); return "\(closure)" }, + expectedResult: "\(closure)") + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledChar(toSay:)), + sendMessage: { x in x.voidJustCalledChar(toSay: 3); return 3 }, + expectedResult: 3) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledShort(toSay:)), + sendMessage: { x in x.voidJustCalledShort(toSay: 4); return 4 }, + expectedResult: 4) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledInt(toSay:)), + sendMessage: { x in x.voidJustCalledInt(toSay: 5); return 5 }, + expectedResult: 5) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledLong(toSay:)), + sendMessage: { x in x.voidJustCalledLong(toSay: 6); return 6 }, + expectedResult: 6) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledUnsignedChar(toSay:)), + sendMessage: { x in x.voidJustCalledUnsignedChar(toSay: 8); return 8 }, + expectedResult: 8) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledUnsignedShort(toSay:)), + sendMessage: { x in x.voidJustCalledUnsignedShort(toSay: 9); return 9 }, + expectedResult: 9) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledUnsignedInt(toSay:)), + sendMessage: { x in x.voidJustCalledUnsignedInt(toSay: 10); return 10 }, + expectedResult: 10) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledUnsignedLong(toSay:)), + sendMessage: { x in x.voidJustCalledUnsignedLong(toSay: 11); return 11 }, + expectedResult: 11) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledDouble(toSay:)), + sendMessage: { x in x.voidJustCalledDouble(toSay: 13); return 13 }, + expectedResult: 13) + _testMessageRecordedAndAllCallsAreMade(#selector(SentMessageTestBase_shared.voidJustCalledFloat(toSay:)), sendMessage: { x in x.voidJustCalledFloat(toSay: 13); return 13 }, expectedResult: 13) let endRuntimeState = RxObjCRuntimeState() diff --git a/Tests/RxCocoaTests/UIScrollView+RxTests.swift b/Tests/RxCocoaTests/UIScrollView+RxTests.swift index 71b504b8..b4caa074 100644 --- a/Tests/RxCocoaTests/UIScrollView+RxTests.swift +++ b/Tests/RxCocoaTests/UIScrollView+RxTests.swift @@ -22,16 +22,16 @@ extension UIScrollViewTests { func testScrollEnabled_False() { let scrollView = UIScrollView(frame: CGRect.zero) - scrollView.scrollEnabled = true + scrollView.isScrollEnabled = true Observable.just(false).bindTo(scrollView.rx_scrollEnabled).dispose() - XCTAssertTrue(scrollView.scrollEnabled == false) + XCTAssertTrue(scrollView.isScrollEnabled == false) } func testScrollEnabled_True() { let scrollView = UIScrollView(frame: CGRect.zero) - scrollView.scrollEnabled = false + scrollView.isScrollEnabled = false Observable.just(true).bindTo(scrollView.rx_scrollEnabled).dispose() - XCTAssertTrue(scrollView.scrollEnabled == true) + XCTAssertTrue(scrollView.isScrollEnabled == true) } } diff --git a/Tests/RxCocoaTests/UITabBar+RxTests.swift b/Tests/RxCocoaTests/UITabBar+RxTests.swift index 207210d7..d5ea174f 100644 --- a/Tests/RxCocoaTests/UITabBar+RxTests.swift +++ b/Tests/RxCocoaTests/UITabBar+RxTests.swift @@ -16,7 +16,7 @@ import UIKit import XCTest class UITabBarTests: RxTest { - let createSubject: () -> UITabBar = { UITabBar(frame: CGRectMake(0, 0, 1, 1)) } + let createSubject: () -> UITabBar = { UITabBar(frame: CGRect(x: 0, y: 0, width: 1, height: 1)) } } /** @@ -35,8 +35,7 @@ extension UITabBarTests { .subscribeNext { i in returnedItems = i } - - subject.delegate!.tabBar!(subject, willBeginCustomizingItems: items) + subject.delegate!.tabBar!(subject, willBeginCustomizing: items) XCTAssertEqual(returnedItems, items) } @@ -52,7 +51,7 @@ extension UITabBarTests { returnedItems = i } - subject.delegate!.tabBar!(subject, didBeginCustomizingItems: items) + subject.delegate!.tabBar!(subject, didBeginCustomizing: items) XCTAssertEqual(returnedItems, items) } @@ -69,8 +68,7 @@ extension UITabBarTests { returnedItems = i changed = c } - - subject.delegate!.tabBar!(subject, willEndCustomizingItems: items, changed: true) + subject.delegate!.tabBar!(subject, willEndCustomizing: items, changed: true) XCTAssertEqual(returnedItems, items) XCTAssertEqual(changed, true) @@ -89,7 +87,7 @@ extension UITabBarTests { changed = c } - subject.delegate!.tabBar!(subject, didEndCustomizingItems: items, changed: true) + subject.delegate!.tabBar!(subject, didEndCustomizing: items, changed: true) XCTAssertEqual(returnedItems, items) XCTAssertEqual(changed, true) @@ -113,9 +111,9 @@ extension UITabBarTests { .subscribeNext { i in returnedItem = i } - - subject.delegate!.tabBar!(subject, didSelectItem: item) - + + subject.delegate!.tabBar!(subject, didSelect: item) + XCTAssertEqual(returnedItem, item) }