20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#ifndef _WIN32
#define ZD "%zd"
#else
#define ZD "%u"
#endif
#define NUM_TESTS 53
#define SUCCESS \
printf("\r\033[1;%dmTests successful: " ZD "/%d\033[0m", \
(i == NUM_TESTS - 1 ? 32 : 33), i + 1, NUM_TESTS); \
fflush(stdout);
#define FAIL \
printf("\r\033[K\033[1;31mTest " ZD "/%d failed!\033[m\n", \
i + 1, NUM_TESTS); \
|
|
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#ifndef _WIN32
#define ZD "%zd"
#else
#define ZD "%u"
#endif
#define NUM_TESTS 60
#define SUCCESS \
printf("\r\033[1;%dmTests successful: " ZD "/%d\033[0m", \
(i == NUM_TESTS - 1 ? 32 : 33), i + 1, NUM_TESTS); \
fflush(stdout);
#define FAIL \
printf("\r\033[K\033[1;31mTest " ZD "/%d failed!\033[m\n", \
i + 1, NUM_TESTS); \
|
197
198
199
200
201
202
203
204
205
206
207
208
|
h = [[EntityHandler alloc] init];
s1 = [@"x&foo;y" stringByXMLUnescapingWithHandler: h];
CHECK([s1 isEqual: @"xbary"]);
CHECK_EXCEPT([@"x&" stringByXMLUnescaping],
OFInvalidEncodingException)
puts("");
return 0;
}
|
>
>
>
>
>
>
>
>
>
>
>
|
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
h = [[EntityHandler alloc] init];
s1 = [@"x&foo;y" stringByXMLUnescapingWithHandler: h];
CHECK([s1 isEqual: @"xbary"]);
CHECK_EXCEPT([@"x&" stringByXMLUnescaping],
OFInvalidEncodingException)
CHECK([[@"y" stringByXMLUnescaping] isEqual: @"y"]);
CHECK([[@"ä" stringByXMLUnescaping] isEqual: @"ä"]);
CHECK([[@"€" stringByXMLUnescaping] isEqual: @"€"]);
CHECK([[@"𝄞" stringByXMLUnescaping] isEqual: @"𝄞"]);
CHECK_EXCEPT([@"&#;" stringByXMLUnescaping], OFInvalidEncodingException)
CHECK_EXCEPT([@"&#x;" stringByXMLUnescaping],
OFInvalidEncodingException)
CHECK_EXCEPT([@"&#xg;" stringByXMLUnescaping],
OFInvalidEncodingException)
puts("");
return 0;
}
|