diff --git a/Tests/Unit/GNUmakefile b/Tests/Unit/GNUmakefile index 2f2c69231..414a2cb1a 100644 --- a/Tests/Unit/GNUmakefile +++ b/Tests/Unit/GNUmakefile @@ -28,8 +28,8 @@ $(TEST_TOOL)_OBJC_FILES += \ TestNSString+Crypto.m \ TestNSString+URLEscaping.m \ TestNSString+Utilities.m \ - \ - TestNGMailAddressParser.m + \ + TestNGMailAddressParser.m TEST_TOOL_NAME = $(TEST_TOOL) diff --git a/Tests/Unit/TestNGMailAddressParser.m b/Tests/Unit/TestNGMailAddressParser.m index b8680f8e3..92ce00373 100644 --- a/Tests/Unit/TestNGMailAddressParser.m +++ b/Tests/Unit/TestNGMailAddressParser.m @@ -35,31 +35,31 @@ - (void) test_singleEmailParsing_value_ { NSArray *rawAddresses = [NSArray arrayWithObjects: - @"wolfgang@test.com", // email alone - @"", // email between brackets - @"\"\" ", // doubled -// @"\"wolfgang@inverse.ca\" ", // with and without br. - @"Àñinéoblabla ", // accented full name - @"Àñinéoblabla Bla Blé ", // accented and multiword - @"Wolfgang Sourdeau \"Bla Bla\" ", // partly quoted - @"Wolfgang Sourdeau ", // full name + email - @"Wolfgang, Sourdeau ", // full name with comma + email - @"wolf", // name only, no domain + @"johndown@test.com", // email alone + @"", // email between brackets + @"\"\" ", // doubled +// @"\"johndown@inverse.ca\" ", // with and without br. + @"Àñinéoblabla ", // accented full name + @"Àñinéoblabla Bla Blé ", // accented and multiword + @"John Down \"Bla Bla\" ", // partly quoted + @"John Down ", // full name + email + @"John, Down ", // full name with comma + email + @"john", // name only, no domain nil ]; NSArray *expectedAddresses = [NSArray arrayWithObjects: - @"wolfgang@test.com", // email alone - @"wolfgang@test.com", // email between brackets - @"wolfgang@test.com", // doubled -// @"\"wolfgang@inverse.ca\" ", // with and without br. - @"wolfgang@test.com", // accented full name - @"wolfgang@test.com", // accented + @"johndown@test.com", // email alone + @"johndown@test.com", // email between brackets + @"johndown@test.com", // doubled +// @"\"johndown@inverse.ca\" ", // with and without br. + @"johndown@test.com", // accented full name + @"johndown@test.com", // accented // and multiword /* NOTE: the following are wrong but tolerated for now */ - @"wolfgang@test.com", // partly quoted - @"wolfgang@test.com", // full name + email - @"wolfgang@test.com", // full name with comma + email - @"wolf", // name only, no domain + @"johndown@test.com", // partly quoted + @"johndown@test.com", // full name + email + @"johndown@test.com", // full name with comma + email + @"john", // name only, no domain nil ]; NSString *rawAddress, *currentExp, *result, *error; NGMailAddressParser *parser; @@ -72,12 +72,7 @@ currentExp = [expectedAddresses objectAtIndex:count]; parser = [NGMailAddressParser mailAddressParserWithString: rawAddress]; parsedRecipient = [parser parse]; - //NSLog(@"COUNT: %d", count); - //NSLog(@"\trawAddress: %@", rawAddress); - //NSLog(@"\tparsedRecipient: %@", parsedRecipient); result = [parsedRecipient address]; - //NSLog(@"\tresult: %@", result); - //NSLog(@"\tcurrentExp: %@", currentExp); error = [NSString stringWithFormat: @"received '%@' instead of '%@' for '%@'", result, currentExp, rawAddress]; @@ -88,21 +83,21 @@ - (void) test_multipleEmailParsing_value_ { NSArray *rawAddresses = [NSArray arrayWithObjects: - @"wolfgang@test.com", // email alone + @"johndown@test.com", // email alone @"test1a@test.com, test1b@here.now", - @"\"wolfgang@inverse.ca\" ", // with and without br. - @"Wolf One , Wolf Two ", // TWO full names + email - @"Three, Wolf , Four, Wolf ", // TWO full names with comma + email - @"luc, francis", // Two partial names + @"\"johndown@inverse.ca\" ", // with and without br. + @"John One , John Two ", // TWO full names + email + @"Three, John , Four, John ", // TWO full names with comma + email + @"john, down", // Two partial names @"Three A , Three B , Three C ", // Three mails nil ]; NSArray *expectedAddresses = [NSArray arrayWithObjects: - [NSArray arrayWithObjects: @"wolfgang@test.com", nil], // email alone + [NSArray arrayWithObjects: @"johndown@test.com", nil], // email alone [NSArray arrayWithObjects: @"test1a@test.com", @"test1b@here.now", nil], // test1 a/b - [NSArray arrayWithObjects: @"wolfgang@test.com", nil], // with and without br. + [NSArray arrayWithObjects: @"johndown@test.com", nil], // with and without br. [NSArray arrayWithObjects: @"test2a@test.com", @"test2b@here.now", nil], // test2 a/b [NSArray arrayWithObjects: @"test3a@test.com", @"test3b@here.now", nil], // test3 a/b - [NSArray arrayWithObjects: @"luc", @"francis", nil], + [NSArray arrayWithObjects: @"john", @"down", nil], [NSArray arrayWithObjects: @"threea@test.com", @"threeb@test.com", @"threec@test.com", nil], // test a/b/c nil ]; NSString *currentRaw, *currentExp, *result, *error; @@ -116,22 +111,14 @@ { currentRaw = [rawAddresses objectAtIndex: count]; expectedRecipients = [expectedAddresses objectAtIndex: count]; - //NSLog(@"COUNT: %d", count); - //NSLog(@"\tcurrentRaw: %@", currentRaw); - //NSLog(@"\texpectedRecipients: %@", expectedRecipients); parser = [NGMailAddressParser mailAddressParserWithString: currentRaw]; parsedRecipients = [parser parseAddressList]; - //NSLog(@"\tparsedRecipients: %@ (count %d)", parsedRecipients, [parsedRecipients count]); int innercount; for (innercount = 0; innercount < [parsedRecipients count]; innercount++) { - //NSLog(@"\t\tcount: %d innercount:%d", count, innercount); parsedRecipient = [parsedRecipients objectAtIndex:innercount]; - //NSLog(@"\t\tparsedRecipient: %@", parsedRecipient); result = [parsedRecipient address]; - //NSLog(@"\t\tresult: %@", result); currentExp = [expectedRecipients objectAtIndex:innercount]; - //NSLog(@"\t\tcurrentExp: %@", result, currentExp); error = [NSString stringWithFormat: @"received '%@' instead of '%@' for '%@'", result, currentExp, currentRaw];