Bug 242693 - Smarter handling (even just a parsing error!) of semicolon-separated addresses in To: field; add test cases in comment 24.

r=Standard8.
This commit is contained in:
Jae-Seong Lee-Russo 2010-02-03 17:05:39 +01:00
Родитель 8b55e2a617
Коммит c91185d278
1 изменённых файлов: 67 добавлений и 12 удалений

Просмотреть файл

@ -5,35 +5,90 @@
*/
const splitRecipientsTests =
[ { recipients: "me@invalid.com",
[ { recipients: "me@foo.invalid",
emailAddressOnly: false,
count: 1,
result: [ "me@invalid.com" ]
result: [ "me@foo.invalid" ]
},
{ recipients: "me@invalid.com, me2@invalid.com",
{ recipients: "me@foo.invalid, me2@foo.invalid",
emailAddressOnly: false,
count: 2,
result: [ "me@invalid.com", "me2@invalid.com" ]
result: [ "me@foo.invalid", "me2@foo.invalid" ]
},
{ recipients: '"foo bar" <me@invalid.com>',
{ recipients: '"foo bar" <me@foo.invalid>',
emailAddressOnly: false,
count: 1,
result: [ '"foo bar" <me@invalid.com>' ]
result: [ '"foo bar" <me@foo.invalid>' ]
},
{ recipients: '"foo bar" <me@invalid.com>',
{ recipients: '"foo bar" <me@foo.invalid>',
emailAddressOnly: true,
count: 1,
result: [ 'me@invalid.com' ]
result: [ 'me@foo.invalid' ]
},
{ recipients: '"foo bar" <me@invalid.com>, "bar foo" <me2@invalid.com>',
{ recipients: '"foo bar" <me@foo.invalid>, "bar foo" <me2@foo.invalid>',
emailAddressOnly: false,
count: 2,
result: [ '"foo bar" <me@invalid.com>', '"bar foo" <me2@invalid.com>' ]
result: [ '"foo bar" <me@foo.invalid>', '"bar foo" <me2@foo.invalid>' ]
},
{ recipients: '"foo bar" <me@invalid.com>, "bar foo" <me2@invalid.com>',
{ recipients: '"foo bar" <me@foo.invalid>, "bar foo" <me2@foo.invalid>',
emailAddressOnly: true,
count: 2,
result: [ "me@invalid.com", "me2@invalid.com" ]
result: [ "me@foo.invalid", "me2@foo.invalid" ]
},
{ recipients: "A Group:Ed Jones <c@a.invalid>,joe@where.invalid,John <jdoe@one.invalid>;",
emailAddressOnly: false,
count: 3,
result: [ "Ed Jones <c@a.invalid>", "joe@where.invalid", "John <jdoe@one.invalid>" ]
},
{ recipients: 'mygroup:;, empty:;, foo@foo.invalid, othergroup:bar@foo.invalid, bar2@foo.invalid;, y@y.invalid, empty:;',
emailAddressOnly: true,
count: 4,
result: [ "foo@foo.invalid", "bar@foo.invalid", "bar2@foo.invalid", "y@y.invalid" ]
},
{ recipients: 'Undisclosed recipients:;;;;;;;;;;;;;;;;,,,,,,,,,,,,,,,,',
emailAddressOnly: true,
count: 0,
result: []
},
{ recipients: 'a@xxx.invalid; b@xxx.invalid',
emailAddressOnly: true,
count: 2,
result: [ "a@xxx.invalid", "b@xxx.invalid" ]
},
{ recipients: 'a@xxx.invalid; B <b@xxx.invalid>',
emailAddressOnly: false,
count: 2,
result: [ "a@xxx.invalid", 'B <b@xxx.invalid>' ]
},
{ recipients: '"A " <a@xxx.invalid>; b@xxx.invalid',
emailAddressOnly: false,
count: 2,
result: [ '"A " <a@xxx.invalid>', "b@xxx.invalid" ]
},
{ recipients: 'A <a@xxx.invalid>; B <b@xxx.invalid>',
emailAddressOnly: false,
count: 2,
result: [ "A <a@xxx.invalid>", 'B <b@xxx.invalid>' ]
},
{ recipients: "A (this: is, a comment;) <a.invalid>; g: (this: is, <a> comment;) C <c.invalid>, d.invalid;",
emailAddressOnly: false,
count: 3,
result: [ '"A (this: is, a comment;)" <a.invalid>', '"(this: is, <a> comment;) C" <c.invalid>', "d.invalid" ]
},
{ recipients: 'Mary Smith <mary@x.invalid>, extra:;, group:jdoe@example.invalid; Who? <one@y.invalid>; <boss@nil.invalid>, "Giant; \"Big\" Box" <sysservices@example.invalid>, ',
emailAddressOnly: false,
count: 5,
result: [ "Mary Smith <mary@x.invalid>", "jdoe@example.invalid", "Who? <one@y.invalid>", "boss@nil.invalid", '"Giant; \"Big\" Box" <sysservices@example.invalid>' ]
},
{ recipients: 'Undisclosed recipients: a@foo.invalid ;;extra:;',
emailAddressOnly: true,
count: 1,
result: [ 'a@foo.invalid' ]
},
{ recipients: 'Undisclosed recipients:;;extra:a@foo.invalid;',
emailAddressOnly: true,
count: 1,
result: [ 'a@foo.invalid' ]
},
{ recipients: "",
emailAddressOnly: false,