mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix typos in comments, add a couple of testcases
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39414 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1417e2c656
commit
49fc46614e
2 changed files with 22 additions and 6 deletions
|
@ -4072,7 +4072,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
|
|||
NSUInteger overhead;
|
||||
|
||||
/* The overhead is the number of bytes needed to wrap an
|
||||
* encoded word in the formt =?csetname?B?encodedtext?=
|
||||
* encoded word in the format =?csetname?B?encodedtext?=
|
||||
*/
|
||||
csetLength = [cset length];
|
||||
overhead = csetLength + 7;
|
||||
|
@ -4129,7 +4129,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
|
|||
quotedLength = 4 * ((charLength + 2) / 3);
|
||||
}
|
||||
|
||||
/* make sure we have enough spoace in the output buffer.
|
||||
/* make sure we have enough space in the output buffer.
|
||||
*/
|
||||
existingLength = [m length];
|
||||
[m setLength: existingLength + quotedLength + overhead];
|
||||
|
|
|
@ -5,21 +5,37 @@
|
|||
int main(int argc,char **argv)
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSString *data = nil;
|
||||
NSData *data = nil;
|
||||
NSString *string = nil;
|
||||
GSMimeDocument *doc = [[GSMimeDocument alloc] init];
|
||||
NSMutableDictionary *par = [[NSMutableDictionary alloc] init];
|
||||
|
||||
[par setObject: @"my/type" forKey: @"type"];
|
||||
[doc setContent: @"Hello\r\n"];
|
||||
[doc setHeader: [[GSMimeHeader alloc] initWithName: @"content-type"
|
||||
value: @"text/plain"
|
||||
parameters: par]];
|
||||
|
||||
[doc setHeader: [[GSMimeHeader alloc] initWithName: @"content-transfer-encoding"
|
||||
value: @"binary"
|
||||
parameters: nil]];
|
||||
[doc setHeader:
|
||||
[[GSMimeHeader alloc] initWithName: @"content-transfer-encoding"
|
||||
value: @"binary"
|
||||
parameters: nil]];
|
||||
|
||||
data = [NSData dataWithContentsOfFile: @"mime8.dat"];
|
||||
PASS([[doc rawMimeData] isEqual: data], "Can make a simple document");
|
||||
|
||||
string = @"MBNA credit card account − more information about Apple Pay.";
|
||||
[doc setHeader:
|
||||
[[GSMimeHeader alloc] initWithName: @"subject"
|
||||
value: string
|
||||
parameters: nil]];
|
||||
data = [doc rawMimeData];
|
||||
PASS(data != nil, "Can use non-ascii character in subject");
|
||||
[[doc rawMimeData] writeToFile: @"/tmp/xyz" atomically: NO];
|
||||
doc = [GSMimeParser documentFromData: data];
|
||||
PASS_EQUAL([[doc headerNamed: @"subject"] value], string,
|
||||
"Can restore non-ascii character in subject");
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue