12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include "config.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFAutoreleasePool.h"
#import "OFExceptions.h"
#import "main.h"
static OFString *module = @"OFString";
static OFString* whitespace[] = {
@" \r \t\n\t \tasd \t \t\t\r\n",
@" \t\t \t\t \t \t"
};
@interface EntityHandler: OFObject <OFXMLUnescapingDelegate>
@end
@implementation EntityHandler
- (OFString*)foundUnknownEntityNamed: (OFString*)entity
{
if ([entity isEqual: @"foo"])
return @"bar";
return nil;
}
@end
void
string_tests()
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFMutableString *s[3];
OFArray *a;
int i;
EntityHandler *h;
|
|
|
|
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include "config.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFAutoreleasePool.h"
#import "OFExceptions.h"
#import "TestsAppDelegate.h"
static OFString *module = @"OFString";
static OFString* whitespace[] = {
@" \r \t\n\t \tasd \t \t\t\r\n",
@" \t\t \t\t \t \t"
};
@interface EntityHandler: OFObject <OFXMLUnescapingDelegate>
@end
@implementation EntityHandler
- (OFString*)foundUnknownEntityNamed: (OFString*)entity
{
if ([entity isEqual: @"foo"])
return @"bar";
return nil;
}
@end
@implementation TestsAppDelegate (OFStringTests)
- (void)stringTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFMutableString *s[3];
OFArray *a;
int i;
EntityHandler *h;
|
337
338
339
340
341
342
343
|
TEST(@"-[stringByXMLUnescapingWithHandler:]",
(h = [[[EntityHandler alloc] init] autorelease]) &&
(s[0] = [@"x&foo;y" stringByXMLUnescapingWithHandler: h]) &&
[s[0] isEqual: @"xbary"])
[pool drain];
}
|
>
|
337
338
339
340
341
342
343
344
|
TEST(@"-[stringByXMLUnescapingWithHandler:]",
(h = [[[EntityHandler alloc] init] autorelease]) &&
(s[0] = [@"x&foo;y" stringByXMLUnescapingWithHandler: h]) &&
[s[0] isEqual: @"xbary"])
[pool drain];
}
@end
|