Patrick Rein uploaded a new version of NetworkTests to project The Trunk:
http://source.squeak.org/trunk/NetworkTests-pre.50.mcz ==================== Summary ==================== Name: NetworkTests-pre.50 Author: pre Time: 6 September 2017, 7:53:00.334204 pm UUID: b7cc6ccd-9d08-0141-a4d7-b3ad3eaca877 Ancestors: NetworkTests-pre.49 Changes the test case for the logic of the mail address parser to only accept actual lists of email addresses, also adds a test case for parsing out the names in front of email addresses. =============== Diff against NetworkTests-pre.49 =============== Item was added: + ----- Method: MailAddressParserTest>>stringOfMailAddresses (in category 'fixtures') ----- + stringOfMailAddresses + ^ '[hidden email], [hidden email], [hidden email], joe4 , Not an Address <joe5@address>, joe.(annoying (nested) comment)literal@[1.2.3.4], "an annoying" group : joe1@groupie, joe2@groupie, "Joey3" joe3@groupy, "joe6"."joe8"@group.com;, Lex''s email account <lex>, [hidden email], romeo&[hidden email], "Name" [hidden email]'.! Item was added: + ----- Method: MailAddressParserTest>>testAddressesAndNamePairsIn (in category 'tests') ----- + testAddressesAndNamePairsIn + + | correctAnswer parsedParis | + + correctAnswer := #( + ('' '[hidden email]') + ('' '[hidden email]') + ('' '[hidden email]') + ('' 'joe4') + ('Not an Address' 'joe5@address') + ('' 'joe.literal@[1.2.3.4]') + ('' 'joe1@groupie') + ('' 'joe2@groupie') + ('Joey3' 'joe3@groupy') + ('' '"joe6"."joe8"@group.com') + ('Lex''s email account' 'lex') + ('' '[hidden email]') + ('' 'romeo&[hidden email]') + ('Name' '[hidden email]')) asOrderedCollection. + + parsedParis := MailAddressParser addressesAndNamePairsIn: self stringOfMailAddresses. + self assert: correctAnswer equals: parsedParis.! Item was changed: ----- Method: MailAddressParserTest>>testAddressesIn (in category 'tests') ----- testAddressesIn + | correctAnswer | - | testString correctAnswer | + correctAnswer := #( + '[hidden email]' + '[hidden email]' + '[hidden email]' + 'joe4' + 'joe5@address' + 'joe.literal@[1.2.3.4]' + 'joe1@groupie' + 'joe2@groupie' + 'joe3@groupy' + '"joe6"."joe8"@group.com' + 'lex' + '[hidden email]' + 'romeo&[hidden email]' + '[hidden email]') asOrderedCollection. - testString := '[hidden email], [hidden email] [hidden email] joe4 , Not an Address <joe5@address>, joe.(annoying (nested) comment)literal@[1.2.3.4], "an annoying" group : joe1@groupie, joe2@groupie, "Joey" joe3@groupy, "joe6"."joe8"@group.com;, Lex''s email account <lex>, [hidden email] romeo&[hidden email]'. + self assert: correctAnswer equals: (MailAddressParser addressesIn: self stringOfMailAddresses).! - correctAnswer := #('[hidden email]' '[hidden email]' '[hidden email]' 'joe4' 'joe5@address' 'joe.literal@[1.2.3.4]' 'joe1@groupie' 'joe2@groupie' '"Joey"' 'joe3@groupy' '"joe6"."joe8"@group.com' 'lex' '[hidden email]' 'romeo&[hidden email]') asOrderedCollection. - - self assert: ((MailAddressParser addressesIn: testString) = correctAnswer).! |
Free forum by Nabble | Edit this page |