diff options
author | Leah Neukirchen <leah@vuxu.org> | 2018-01-14 21:38:41 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2018-01-14 21:38:41 +0100 |
commit | fe3e1629a6c2eb6949c6882bc269f9cda87b4e5b (patch) | |
tree | dec8ae4fbd4c28fbed507f0ad62fe36656c3a852 /t | |
parent | 2708f184e9efe8e733798bf513ff9137bcb5b6c2 (diff) | |
download | mblaze-fe3e1629a6c2eb6949c6882bc269f9cda87b4e5b.tar.gz mblaze-fe3e1629a6c2eb6949c6882bc269f9cda87b4e5b.tar.xz mblaze-fe3e1629a6c2eb6949c6882bc269f9cda87b4e5b.zip |
t/1501-maddr-regress.t: add regression tests for address parsing
Diffstat (limited to 't')
-rwxr-xr-x | t/1501-maddr-regress.t | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/t/1501-maddr-regress.t b/t/1501-maddr-regress.t new file mode 100755 index 0000000..ee1da50 --- /dev/null +++ b/t/1501-maddr-regress.t @@ -0,0 +1,42 @@ +#!/bin/sh +cd ${0%/*} +. ./lib.sh +plan 26 + +check_addr() { + printf "From: %s\n" "$1" | check_test "parse $1" = "$2" "maddr /dev/stdin" +} + +check_addr 'foo@example.org' 'foo@example.org' +check_addr '<foo@example.org>' 'foo@example.org' +check_addr 'bar <foo@example.org>' 'bar <foo@example.org>' +check_addr 'bar quux <foo@example.org>' 'bar quux <foo@example.org>' +check_addr 'bar quux <foo@example.org>' 'bar quux <foo@example.org>' +check_addr '<foo@example.org> (bar)' 'bar <foo@example.org>' +check_addr '"Real Name" <foo@example.org>' 'Real Name <foo@example.org>' +check_addr '"Dr. Real Name" <foo@example.org>' 'Dr. Real Name <foo@example.org>' +check_addr '"Real Name" (show this) <foo@example.org>' 'Real Name (show this) <foo@example.org>' +check_addr '"Real Name" <foo@example.org> (ignore this)' 'Real Name (ignore this) <foo@example.org>' + +check_addr '(nested (comments mail@here ) heh) "yep (yap)" <foo@example.org>' 'yep (yap) <foo@example.org>' + +check_addr 'ignore-this: <foo@example.org>' 'foo@example.org' +check_addr 'ignore-this : <foo@example.org>' 'foo@example.org' +check_addr '"foo"@example.org' 'foo@example.org' +check_addr '"Barqux" "foo"@example.org' 'Barqux <foo@example.org>' +check_addr 'Space Man <"space man"@example.org>' 'Space Man <"space man"@example.org>' +check_addr 'Space Man <"space man"@example.org>' 'Space Man <"space man"@example.org>' +check_addr '<spaceman@example.org >' 'spaceman@example.org' +check_addr '< spaceman@example.org >' 'spaceman@example.org' +check_addr '<spaceman@(wtf)example.org >' 'spaceman@example.org' +check_addr 'space\man@example.org' 'spaceman@example.org' + +check_addr 'what is <"this<evil(h\"eh)sh>it"@example.org>' 'what is <"this<evil(h\"eh)sh>it"@example.org>' + +check_addr 'foo@example.org <foo@example.org>' 'foo@example.org' + +check_addr 'foo@[::1] (ipv6)' 'ipv6 <foo@[::1]>' + +# invalid addresses +check_addr '<Foo Bar <foobar@qux.com>' 'foobar@qux.com' +check_addr '"abc@def"@ghi' '' \ No newline at end of file |