diff options
-rw-r--r-- | Foundation/GTMFileSystemKQueue.m | 2 | ||||
-rw-r--r-- | Foundation/GTMFileSystemKQueueTest.m | 26 | ||||
-rw-r--r-- | ReleaseNotes.txt | 3 |
3 files changed, 30 insertions, 1 deletions
diff --git a/Foundation/GTMFileSystemKQueue.m b/Foundation/GTMFileSystemKQueue.m index ad516f7..1db71c1 100644 --- a/Foundation/GTMFileSystemKQueue.m +++ b/Foundation/GTMFileSystemKQueue.m @@ -251,7 +251,7 @@ static void SocketCallBack(CFSocketRef socketref, CFSocketCallBackType type, = [NSInvocation invocationWithMethodSignature:methodSig]; [invocation setTarget:target_]; [invocation setSelector:action_]; - [invocation setArgument:self atIndex:2]; + [invocation setArgument:&self atIndex:2]; [invocation setArgument:&eventFFlags atIndex:3]; [invocation invoke]; } diff --git a/Foundation/GTMFileSystemKQueueTest.m b/Foundation/GTMFileSystemKQueueTest.m index c2ded10..ec1edc0 100644 --- a/Foundation/GTMFileSystemKQueueTest.m +++ b/Foundation/GTMFileSystemKQueueTest.m @@ -32,6 +32,7 @@ @interface GTMFSKQTestHelper : NSObject { @private int writes_, renames_, deletes_; + __weak GTMFileSystemKQueue *queue_; } @end @@ -39,6 +40,19 @@ - (void)callbackForQueue:(GTMFileSystemKQueue *)queue events:(GTMFileSystemKQueueEvents)event { + // Can't use standard ST macros here because our helper + // is not a subclass of GTMTestCase. This is intentional. + if (queue != queue_) { + NSString *file = [NSString stringWithUTF8String:__FILE__]; + NSException *exception + = [NSException failureInEqualityBetweenObject:queue + andObject:queue_ + inFile:file + atLine:__LINE__ + withDescription:nil]; + [exception raise]; + } + if (event & kGTMFileSystemKQueueWriteEvent) { ++writes_; } @@ -61,6 +75,11 @@ - (int)deletes { return deletes_; } + +- (void)setKQueue:(GTMFileSystemKQueue *)queue { + queue_ = queue; +} + @end @@ -178,6 +197,7 @@ action:@selector(callbackForQueue:events:)]; STAssertNotNil(testKQ, nil); STAssertEqualObjects([testKQ path], testPath_, nil); + [helper setKQueue:testKQ]; // Write to the file [testFH writeData:[@"doh!" dataUsingEncoding:NSUnicodeStringEncoding]]; @@ -226,6 +246,8 @@ action:@selector(callbackForQueue:events:)]; STAssertNotNil(testKQ, nil); STAssertEqualObjects([testKQ path], testPath_, nil); + [helper setKQueue:testKQ]; + GTMFileSystemKQueue *testKQ2 = [[GTMFileSystemKQueue alloc] initWithPath:testPath_ forEvents:kGTMFileSystemKQueueAllEvents @@ -234,6 +256,7 @@ action:@selector(callbackForQueue:events:)]; STAssertNotNil(testKQ2, nil); STAssertEqualObjects([testKQ2 path], testPath_, nil); + [helper2 setKQueue:testKQ2]; // Write to the file [testFH writeData:[@"doh!" dataUsingEncoding:NSUnicodeStringEncoding]]; @@ -313,6 +336,8 @@ action:@selector(callbackForQueue:events:)]; STAssertNotNil(testKQ, nil); STAssertEqualObjects([testKQ path], testPath_, nil); + [helper setKQueue:testKQ]; + GTMFileSystemKQueue *testKQ2 = [[GTMFileSystemKQueue alloc] initWithPath:testPath_ forEvents:kGTMFileSystemKQueueAllEvents @@ -321,6 +346,7 @@ action:@selector(callbackForQueue:events:)]; STAssertNotNil(testKQ2, nil); STAssertEqualObjects([testKQ2 path], testPath_, nil); + [helper2 setKQueue:testKQ2]; // Write to the file [testFH writeData:[@"doh!" dataUsingEncoding:NSUnicodeStringEncoding]]; diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 09c78eb..caee619 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -307,6 +307,9 @@ Changes since 1.5.1 - Added support for passing in a context object to some of the GTMNSEnumerator+Filter routines. +- Fixed up bug in GTMFileSystemKQueue where we were passing the kqueue argument + in incorrectly. Added appropriate tests. + Release 1.5.1 Changes since 1.5.0 |