mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
test for non existent directory
This commit is contained in:
parent
a5a9423c10
commit
f0f841c01f
1 changed files with 17 additions and 2 deletions
|
@ -3,6 +3,8 @@
|
|||
#import <Foundation/NSFileManager.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSError.h>
|
||||
#import <Foundation/FoundationErrors.h>
|
||||
|
||||
#import "ObjectTesting.h"
|
||||
|
||||
|
@ -13,6 +15,7 @@
|
|||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSError *error;
|
||||
NSTask *task;
|
||||
NSPipe *outPipe;
|
||||
NSFileManager *mgr;
|
||||
|
@ -51,7 +54,8 @@ int main()
|
|||
PASS([task standardOutput] == outPipe, "standardOutput returns pipe");
|
||||
data = [outHandle readDataToEndOfFile];
|
||||
PASS([data length] > 0, "was able to read data from subtask");
|
||||
NSLog(@"Data was %*.*s", [data length], [data length], [data bytes]);
|
||||
NSLog(@"Data was %*.*s",
|
||||
(int)[data length], (int)[data length], (const char*)[data bytes]);
|
||||
[task terminate];
|
||||
|
||||
task = [[NSTask alloc] init];
|
||||
|
@ -64,7 +68,8 @@ int main()
|
|||
[task launch];
|
||||
data = [outHandle readDataToEndOfFile];
|
||||
PASS([data length] > 0, "was able to read data from subtask");
|
||||
NSLog(@"Data was %*.*s", [data length], [data length], [data bytes]);
|
||||
NSLog(@"Data was %*.*s",
|
||||
(int)[data length], (int)[data length], (const char*)[data bytes]);
|
||||
[task terminate];
|
||||
|
||||
|
||||
|
@ -73,6 +78,16 @@ int main()
|
|||
[outPipe release];
|
||||
[task release];
|
||||
|
||||
task = [[NSTask alloc] init];
|
||||
[task setLaunchPath: [helpers stringByAppendingPathComponent: testcat]];
|
||||
[task setArguments: [NSArray arrayWithObjects: nil]];
|
||||
[task setCurrentDirectoryPath: @"not-a-directory"];
|
||||
PASS([task launchAndReturnError: &error] == NO, "bad directory fails launch")
|
||||
PASS(error != nil, "error is returned")
|
||||
PASS([error domain] == NSCocoaErrorDomain, "error has expected domain")
|
||||
PASS([error code] == NSFileNoSuchFileError, "error has expected code")
|
||||
[task release];
|
||||
|
||||
#if !defined(_WIN32)
|
||||
task = [[NSTask alloc] init];
|
||||
[task setLaunchPath:
|
||||
|
|
Loading…
Reference in a new issue