mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 10:11:03 +00:00
being confusing. They now both take a simple C-string argument which names the set, and the macros check that each end matches a start of the same name. Since tis means that a START_SET no longer takes an argument sayng whether or notthe set is to be skipped, we now have a SKIP macro to be used inside a set to skip to the end of it. This is actually more versatile as we can have multiple SKIP macros in the same set, each providing a different reason for the set being skipped. Also removed a few obsolete/unused functions and macros. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32355 72102866-910b-0410-8b05-ffd578937521
49 lines
1.7 KiB
Objective-C
49 lines
1.7 KiB
Objective-C
#import "ObjectTesting.h"
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
#import <Foundation/NSString.h>
|
|
|
|
int main()
|
|
{
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
|
unichar u0 = 'a';
|
|
unichar u1 = 0xfe66;
|
|
char buf[32];
|
|
NSString *s;
|
|
NSString *testObj = [NSString stringWithCString: "Hello\n"];
|
|
|
|
test_alloc(@"NSString");
|
|
test_NSObject(@"NSString",[NSArray arrayWithObject:testObj]);
|
|
test_NSCoding([NSArray arrayWithObject:testObj]);
|
|
test_NSCopying(@"NSString", @"NSMutableString",
|
|
[NSArray arrayWithObject:testObj], NO, NO);
|
|
test_NSMutableCopying(@"NSString", @"NSMutableString",
|
|
[NSArray arrayWithObject:testObj]);
|
|
|
|
/* Test non-ASCII strings. */
|
|
testObj = [@"\"\\U00C4\\U00DF\"" propertyList];
|
|
test_NSMutableCopying(@"NSString", @"NSMutableString",
|
|
[NSArray arrayWithObject:testObj]);
|
|
|
|
PASS([(s = [[NSString alloc] initWithCharacters: &u0 length: 1])
|
|
isKindOfClass: [NSString class]]
|
|
&& ![s isKindOfClass: [NSMutableString class]],
|
|
"initWithCharacters:length: creates mutable string for ascii");
|
|
|
|
PASS([(s = [[NSString alloc] initWithCharacters: &u1 length: 1])
|
|
isKindOfClass: [NSString class]]
|
|
&& ![s isKindOfClass: [NSMutableString class]],
|
|
"initWithCharacters:length: creates mutable string for unicode");
|
|
|
|
PASS_EXCEPTION([[NSString alloc] initWithString: nil];,
|
|
NSInvalidArgumentException,
|
|
"NSString -initWithString: does not allow nil argument");
|
|
|
|
PASS([@"he" getCString: buf maxLength: 2 encoding: NSASCIIStringEncoding]==NO,
|
|
"buffer exact length fails");
|
|
PASS([@"hell" getCString: buf maxLength: 5 encoding: NSASCIIStringEncoding],
|
|
"buffer length+1 works");
|
|
PASS(strcmp(buf, "hell") == 0, "getCString:maxLength:encoding");
|
|
|
|
[arp release]; arp = nil;
|
|
return 0;
|
|
}
|