diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-05-14 19:35:54 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-05-14 19:35:54 +0000 |
commit | 4f89cfe836e82f9445b98d733d6eb54b86e609d2 (patch) | |
tree | dd5f8eb01940af1a98922254baa93437936dc2ed /Foundation/GTMFileSystemKQueueTest.m | |
parent | 4e865a397220fcca9975de0ed393ed7a145234d2 (diff) |
[Author: dmaclach]
There are still a couple of errors occurring, but this fixes up the majority of stuff. I figured I'd send it out to you now to take
a look at in the morning, and then we can clean up the last couple of issues.
Not quite sure what to do about the naming of data files so that we can encompass ranges of system version (e.g. this file applies to
10.5 and 10.6 but not 10.4 or 10.7.
R=thomasvl
DELTA=10598 (10211 added, 70 deleted, 317 changed)
Diffstat (limited to 'Foundation/GTMFileSystemKQueueTest.m')
-rw-r--r-- | Foundation/GTMFileSystemKQueueTest.m | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/Foundation/GTMFileSystemKQueueTest.m b/Foundation/GTMFileSystemKQueueTest.m index ec1edc0..a64fd2b 100644 --- a/Foundation/GTMFileSystemKQueueTest.m +++ b/Foundation/GTMFileSystemKQueueTest.m @@ -94,16 +94,28 @@ // make sure the files aren't in the way of the test NSFileManager *fm = [NSFileManager defaultManager]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + NSError *error = nil; + [fm removeItemAtPath:testPath_ error:&error]; + [fm removeItemAtPath:testPath2_ error:&error]; +#else [fm removeFileAtPath:testPath_ handler:nil]; [fm removeFileAtPath:testPath2_ handler:nil]; +#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 } - (void)tearDown { // make sure we clean up the files from a failed test NSFileManager *fm = [NSFileManager defaultManager]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + NSError *error = nil; + [fm removeItemAtPath:testPath_ error:&error]; + [fm removeItemAtPath:testPath2_ error:&error]; +#else [fm removeFileAtPath:testPath_ handler:nil]; [fm removeFileAtPath:testPath2_ handler:nil]; - +#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + [testPath_ release]; testPath_ = nil; [testPath2_ release]; @@ -208,7 +220,12 @@ // Close and delete [testFH closeFile]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + NSError *error = nil; + STAssertTrue([fm removeItemAtPath:testPath_ error:&error], @"Err: %@", error); +#else STAssertTrue([fm removeFileAtPath:testPath_ handler:nil], nil); +#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 [self spinForEvents:helper]; STAssertEquals([helper totals], 2, nil); @@ -268,7 +285,12 @@ // Close and delete [testFH closeFile]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + NSError *error = nil; + STAssertTrue([fm removeItemAtPath:testPath_ error:&error], @"Err: %@", error); +#else STAssertTrue([fm removeFileAtPath:testPath_ handler:nil], nil); +#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 // Recreate STAssertTrue([fm createFileAtPath:testPath_ contents:nil attributes:nil], nil); @@ -291,8 +313,12 @@ // Close and delete [testFH closeFile]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + STAssertTrue([fm removeItemAtPath:testPath_ error:&error], @"Err: %@", error); +#else STAssertTrue([fm removeFileAtPath:testPath_ handler:nil], nil); - +#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + // Spin the runloop for a second so that the helper callbacks fire [self spinForEvents:helper]; STAssertEquals([helper totals], 4, nil); @@ -357,7 +383,14 @@ STAssertEquals([helper2 totals], 1, nil); // Move it and create the file again +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + NSError *error = nil; + STAssertTrue([fm moveItemAtPath:testPath_ toPath:testPath2_ error:&error], + @"Error: %@", error); +#else STAssertTrue([fm movePath:testPath_ toPath:testPath2_ handler:nil], nil); +#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + STAssertTrue([fm createFileAtPath:testPath_ contents:nil attributes:nil], nil); NSFileHandle *testFHPrime = [NSFileHandle fileHandleForWritingAtPath:testPath_]; @@ -387,7 +420,11 @@ // and now close old [testFH closeFile]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + STAssertTrue([fm removeItemAtPath:testPath2_ error:&error], @"Err: %@", error); +#else STAssertTrue([fm removeFileAtPath:testPath2_ handler:nil], nil); +#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 // Spin the runloop for a second so that the helper callbacks fire [self spinForEvents:helper]; @@ -396,7 +433,11 @@ // and now close new [testFHPrime closeFile]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + STAssertTrue([fm removeItemAtPath:testPath_ error:&error], @"Err: %@", error); +#else STAssertTrue([fm removeFileAtPath:testPath_ handler:nil], nil); +#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 // Spin the runloop for a second so that the helper callbacks fire [self spinForEvents:helper]; |