mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Detect CRLF in GSMime tests
* Detect CRLF in GSMime tests * Allow either CRLF or LF * Update general.m
This commit is contained in:
parent
5caececdcd
commit
6b537b4a45
1 changed files with 20 additions and 6 deletions
|
@ -76,6 +76,8 @@ int main()
|
|||
NSData *cr;
|
||||
NSData *data;
|
||||
NSData *orig;
|
||||
NSString *obj0;
|
||||
NSString *obj1;
|
||||
NSString *str;
|
||||
GSMimeParser *parser;
|
||||
GSMimeDocument *doc;
|
||||
|
@ -115,7 +117,9 @@ int main()
|
|||
[(NSMutableData*)data appendBytes: "\r\n\r\n" length: 4];
|
||||
[parser parse: data];
|
||||
doc = [parser mimeDocument];
|
||||
PASS([[parser excess] length] == 5, "Can detect excess data in multipart");
|
||||
|
||||
PASS([[parser excess] length] == 5 || [[parser excess] length] == 6,
|
||||
"Can detect excess data in multipart");
|
||||
[parser release];
|
||||
|
||||
data = [NSData dataWithContentsOfFile: @"mime2.dat"];
|
||||
|
@ -138,9 +142,14 @@ int main()
|
|||
|
||||
data = [NSData dataWithContentsOfFile: @"mime4.dat"];
|
||||
idoc = exact(0, data);
|
||||
PASS(([[[[idoc content] objectAtIndex:0] content] isEqual: @"hello\n"]
|
||||
&& [[[[idoc content] objectAtIndex:1] content] isEqual: @"there\n"]),
|
||||
"can parse multi-part text mime4.dat incrementally");
|
||||
|
||||
obj0 = [[[idoc content] objectAtIndex:0] content];
|
||||
obj1 = [[[idoc content] objectAtIndex:1] content];
|
||||
|
||||
PASS(([obj0 isEqual: @"hello\n"] && [obj1 isEqual: @"there\n"])
|
||||
|| ([obj0 isEqual: @"hello\r\n"] && [obj1 isEqual: @"there\r\n"]),
|
||||
"can parse multi-part text mime4.dat incrementally");
|
||||
|
||||
PASS(([[[[idoc content] objectAtIndex:0] contentFile] isEqual: @"a.a"]),
|
||||
"can extract content file name from mime4.dat (incrementally parsed)");
|
||||
PASS(([[[[idoc content] objectAtIndex:0] contentType] isEqual: @"text"]),
|
||||
|
@ -149,9 +158,14 @@ int main()
|
|||
"can extract content sub type from mime4.dat (incrementally parsed)");
|
||||
|
||||
doc = [GSMimeParser documentFromData: data];
|
||||
PASS(([[[[doc content] objectAtIndex:0] content] isEqual: @"hello\n"]
|
||||
&& [[[[doc content] objectAtIndex:1] content] isEqual: @"there\n"]),
|
||||
|
||||
obj0 = [[[doc content] objectAtIndex:0] content];
|
||||
obj1 = [[[doc content] objectAtIndex:1] content];
|
||||
|
||||
PASS(([obj0 isEqual: @"hello\n"] && [obj1 isEqual: @"there\n"])
|
||||
|| ([obj0 isEqual: @"hello\r\n"] && [obj1 isEqual: @"there\r\n"]),
|
||||
"can parse multi-part text mime4.dat in one go");
|
||||
|
||||
PASS(([[[[doc content] objectAtIndex:0] contentFile] isEqual: @"a.a"]),
|
||||
"can extract content file name from mime4.dat (parsed in one go)");
|
||||
PASS(([[[[doc content] objectAtIndex:0] contentType] isEqual: @"text"]),
|
||||
|
|
Loading…
Reference in a new issue