mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 17:10:48 +00:00
Create temporarry file in current directory and delete it when done ... fixes testcase to work on windows.
This commit is contained in:
parent
1b7bf26bea
commit
aff02f4d08
1 changed files with 9 additions and 3 deletions
|
@ -160,7 +160,7 @@
|
|||
|
||||
- (void)cr2549370
|
||||
{
|
||||
NSString *path = @"/tmp/json.data";
|
||||
NSString *path = @"./json.data";
|
||||
NSString *string = @"Hello garçon! ¡Ola! A little more coöperation please!";
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
|
@ -177,6 +177,7 @@
|
|||
[stream open];
|
||||
dict = [NSJSONSerialization JSONObjectWithStream:stream options:0 error:0];
|
||||
dict = [[dict objectForKey: @"datacenters"] objectAtIndex:0];
|
||||
[[NSFileManager defaultManager] removeFileAtPath: path handler: nil];
|
||||
NSAssert(dict != nil, @"JSON returned nil");
|
||||
NSAssert([string isEqualToString:[dict objectForKey: @"nickname"]], @"data mismatch");
|
||||
}
|
||||
|
@ -200,12 +201,17 @@ static NSString *percentQuoted(NSString *s)
|
|||
unsigned char c;
|
||||
const char *allowedNonalnumChars = "-_,.'~!$&*();";
|
||||
|
||||
while ((c = *p++) != '\0') {
|
||||
while ((c = *p++) != '\0')
|
||||
{
|
||||
if (isalnum(c) || strchr(allowedNonalnumChars, c) != 0)
|
||||
{
|
||||
[retval appendFormat: @"%c", c];
|
||||
}
|
||||
else
|
||||
{
|
||||
[retval appendFormat: @"%%%02x", c];
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue