mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +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/NSFileManager.h>
|
||||
#import <Foundation/NSStream.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
#import <Foundation/NSXMLParser.h>
|
||||
#include <string.h>
|
||||
|
@ -256,6 +257,12 @@ testParser(NSXMLParser *parser, NSString *expect)
|
|||
}
|
||||
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])
|
||||
{
|
||||
NSLog(@"######## Expected:\n%@\n######## Parsed:\n%@\n########\n",
|
||||
|
@ -370,6 +377,8 @@ int main()
|
|||
|
||||
{
|
||||
NSString *exp;
|
||||
NSString *mgrPath;
|
||||
NSString *absolutePath;
|
||||
NSData *dat;
|
||||
|
||||
exp = @"parserDidStartDocument:\n\
|
||||
|
@ -378,10 +387,13 @@ parser:didStartElement:namespaceURI:qualifiedName:attributes: file file {\n}\n\
|
|||
parserDidEndDocument:\n\
|
||||
";
|
||||
|
||||
mgrPath = [[mgr currentDirectoryPath] stringByAppendingPathComponent: @"GNUmakefile"];
|
||||
absolutePath = [[NSURL fileURLWithPath: mgrPath] absoluteString];
|
||||
|
||||
str = [NSString stringWithFormat:
|
||||
@"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
||||
@"<!DOCTYPE file [<!ENTITY foo SYSTEM \"file://%@/GNUmakefile\">]>\n"
|
||||
@"<file>&&foo;A</file>", [mgr currentDirectoryPath]];
|
||||
@"<!DOCTYPE file [<!ENTITY foo SYSTEM \"%@\">]>\n"
|
||||
@"<file>&&foo;A</file>", absolutePath];
|
||||
|
||||
dat = [str dataUsingEncoding: NSUTF8StringEncoding];
|
||||
PASS((testParseData(dat, exp, YES)), "external entity (strict)")
|
||||
|
|
Loading…
Reference in a new issue