imap: Better errors when not configured.
parent
9710013460
commit
02976b249d
|
@ -33,29 +33,37 @@ SYMBOLS: email host password ;
|
||||||
email get password get login drop
|
email get password get login drop
|
||||||
] with-stream* ;
|
] with-stream* ;
|
||||||
|
|
||||||
|
ERROR: host-not-set ;
|
||||||
|
|
||||||
|
: get-test-host ( -- host )
|
||||||
|
host get dup [ host-not-set throw ] unless ;
|
||||||
|
|
||||||
|
: ensure-host ( -- ) get-test-host drop ;
|
||||||
|
|
||||||
: imap-test ( result quot -- )
|
: imap-test ( result quot -- )
|
||||||
|
ensure-host
|
||||||
'[ imap-login _ with-stream ] unit-test ; inline
|
'[ imap-login _ with-stream ] unit-test ; inline
|
||||||
|
|
||||||
[ t ] [
|
[ t ] [
|
||||||
host get <imap4ssl> duplex-stream?
|
get-test-host <imap4ssl> duplex-stream?
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ t ] [
|
[ t ] [
|
||||||
host get <imap4ssl> [ capabilities ] with-stream
|
get-test-host <imap4ssl> [ capabilities ] with-stream
|
||||||
{ "IMAP4rev1" "UNSELECT" "IDLE" "NAMESPACE" "QUOTA" } swap subset?
|
{ "IMAP4rev1" "UNSELECT" "IDLE" "NAMESPACE" "QUOTA" } swap subset?
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "NO" ] [
|
[ "NO" ] [
|
||||||
[ host get <imap4ssl> [ "dont@exist.com" "foo" login ] with-stream ]
|
[ get-test-host <imap4ssl> [ "dont@exist.com" "foo" login ] with-stream ]
|
||||||
[ ind>> ] recover
|
[ ind>> ] recover
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "BAD" ] [
|
[ "BAD" ] [
|
||||||
[ host get <imap4ssl> [ f f login ] with-stream ] [ ind>> ] recover
|
[ get-test-host <imap4ssl> [ f f login ] with-stream ] [ ind>> ] recover
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ f ] [
|
[ f ] [
|
||||||
host get <imap4ssl> [
|
get-test-host <imap4ssl> [
|
||||||
email get password get login
|
email get password get login
|
||||||
] with-stream empty?
|
] with-stream empty?
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
Loading…
Reference in New Issue