mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-07 15:01:10 +00:00
Fix NSXMLParser (strict) tests on Windows
This commit is contained in:
parent
ffe938c49e
commit
1ea722a07a
1 changed files with 14 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
#import <Foundation/NSAutoreleasePool.h>
|
#import <Foundation/NSAutoreleasePool.h>
|
||||||
#import <Foundation/NSFileManager.h>
|
#import <Foundation/NSFileManager.h>
|
||||||
#import <Foundation/NSStream.h>
|
#import <Foundation/NSStream.h>
|
||||||
|
#import <Foundation/NSURL.h>
|
||||||
#import <Foundation/NSUserDefaults.h>
|
#import <Foundation/NSUserDefaults.h>
|
||||||
#import <Foundation/NSXMLParser.h>
|
#import <Foundation/NSXMLParser.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -256,6 +257,12 @@ testParser(NSXMLParser *parser, NSString *expect)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
/* Replace CRLF from result files with LF
|
||||||
|
*/
|
||||||
|
expect = [expect stringByReplacingOccurrencesOfString: @"\r\n" withString: @"\n"];
|
||||||
|
#endif
|
||||||
|
|
||||||
if (NO == [[handler description] isEqual: expect])
|
if (NO == [[handler description] isEqual: expect])
|
||||||
{
|
{
|
||||||
NSLog(@"######## Expected:\n%@\n######## Parsed:\n%@\n########\n",
|
NSLog(@"######## Expected:\n%@\n######## Parsed:\n%@\n########\n",
|
||||||
|
@ -370,6 +377,8 @@ int main()
|
||||||
|
|
||||||
{
|
{
|
||||||
NSString *exp;
|
NSString *exp;
|
||||||
|
NSString *mgrPath;
|
||||||
|
NSString *absolutePath;
|
||||||
NSData *dat;
|
NSData *dat;
|
||||||
|
|
||||||
exp = @"parserDidStartDocument:\n\
|
exp = @"parserDidStartDocument:\n\
|
||||||
|
@ -378,10 +387,13 @@ parser:didStartElement:namespaceURI:qualifiedName:attributes: file file {\n}\n\
|
||||||
parserDidEndDocument:\n\
|
parserDidEndDocument:\n\
|
||||||
";
|
";
|
||||||
|
|
||||||
|
mgrPath = [[mgr currentDirectoryPath] stringByAppendingPathComponent: @"GNUmakefile"];
|
||||||
|
absolutePath = [[NSURL fileURLWithPath: mgrPath] absoluteString];
|
||||||
|
|
||||||
str = [NSString stringWithFormat:
|
str = [NSString stringWithFormat:
|
||||||
@"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
@"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
||||||
@"<!DOCTYPE file [<!ENTITY foo SYSTEM \"file://%@/GNUmakefile\">]>\n"
|
@"<!DOCTYPE file [<!ENTITY foo SYSTEM \"%@\">]>\n"
|
||||||
@"<file>&&foo;A</file>", [mgr currentDirectoryPath]];
|
@"<file>&&foo;A</file>", absolutePath];
|
||||||
|
|
||||||
dat = [str dataUsingEncoding: NSUTF8StringEncoding];
|
dat = [str dataUsingEncoding: NSUTF8StringEncoding];
|
||||||
PASS((testParseData(dat, exp, YES)), "external entity (strict)")
|
PASS((testParseData(dat, exp, YES)), "external entity (strict)")
|
||||||
|
|
Loading…
Reference in a new issue