diff --git a/Source/NSPropertyList.m b/Source/NSPropertyList.m index d9f067989..fa6861c45 100644 --- a/Source/NSPropertyList.m +++ b/Source/NSPropertyList.m @@ -1970,12 +1970,18 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step, } else if ([obj isKindOfClass: NSDataClass]) { - if (x == NSPropertyListXMLFormat_v1_0) + if (NSPropertyListXMLFormat_v1_0 == x) { [dest appendBytes: "\n" length: 7]; encodeBase64(obj, dest); [dest appendBytes: "\n" length: 8]; } + else if (NSPropertyListGNUstepFormat == x) + { + [dest appendBytes: "<[" length: 2]; + encodeBase64(obj, dest); + [dest appendBytes: "]>" length: 2]; + } else { const unsigned char *src; diff --git a/Tests/base/PropertyLists/test01.m b/Tests/base/PropertyLists/test01.m index 7e09274fb..99e220510 100644 --- a/Tests/base/PropertyLists/test01.m +++ b/Tests/base/PropertyLists/test01.m @@ -78,6 +78,21 @@ test_parse_unparse_binary_old(id object) errorDescription: 0]; return [u isEqual: object]; } +static BOOL +test_parse_unparse_gnustep(id object) +{ + NSPropertyListFormat format; + NSData *d; + id u; + + d = [NSPropertyListSerialization dataFromPropertyList: object + format: NSPropertyListGNUstepFormat errorDescription: 0]; + u = [NSPropertyListSerialization propertyListFromData: d + mutabilityOption: NSPropertyListImmutable + format: &format + errorDescription: 0]; + return [u isEqual: object]; +} #endif int main() @@ -86,7 +101,7 @@ int main() int i; NSAutoreleasePool *arp = [NSAutoreleasePool new]; - for (i = 0; i < 5; i++) + for (i = 0; i < 6; i++) { switch (i) { @@ -106,6 +121,13 @@ int main() func = test_parse_unparse_openstep; NSLog(@"test OpenStep"); break; + case 4: +#if defined(GNUSTEP_BASE_LIBRARY) + func = test_parse_unparse_gnustep; + NSLog(@"test GNUStep text"); +#else + func = 0; +#endif case 5: #if defined(GNUSTEP_BASE_LIBRARY) func = test_parse_unparse_binary_old; @@ -121,6 +143,9 @@ int main() PASS(func(@"ariosto"), "We can generate a property list from a string"); + PASS(func([@"ariosto" dataUsingEncoding: NSASCIIStringEncoding]), + "We can generate a property list from data"); + PASS(func([NSArray array]), "We can generate a property list from an empty array");