imap: try and make tests work from multiple builders at the same time.

db4
John Benediktsson 2014-04-25 21:29:41 -07:00
parent 3184021a6b
commit 88c0028d13
1 changed files with 24 additions and 12 deletions

View File

@ -1,7 +1,9 @@
USING: accessors arrays assocs calendar calendar.format combinators USING: accessors arrays assocs calendar calendar.format
continuations formatting fry grouping.extras imap io.streams.duplex kernel combinators continuations formatting fry grouping.extras imap
math math.parser math.ranges math.statistics namespaces pcre random sequences io.streams.duplex kernel math math.parser math.ranges
sets sorting strings tools.test ; math.statistics namespaces random sequences sets sorting
splitting strings system tools.test ;
FROM: pcre => findall ;
IN: imap.tests IN: imap.tests
: random-ascii ( n -- str ) : random-ascii ( n -- str )
@ -61,9 +63,16 @@ ERROR: no-imap-test-host ;
"ALL" "" search-mails "ALL" "" search-mails
] imap-test ] imap-test
: base-folder ( -- s )
os name>> cpu name>> "-" glue ;
: test-folder ( s -- s )
[ base-folder "/" ] dip 3append ;
! Create delete select again. ! Create delete select again.
[ 0 ] [ [ 0 ] [
"örjan" [ create-folder ] [ select-folder ] [ delete-folder ] tri "örjan" test-folder
[ create-folder ] [ select-folder ] [ delete-folder ] tri
] imap-test ] imap-test
! Test list folders ! Test list folders
@ -110,27 +119,30 @@ ERROR: no-imap-test-host ;
! Rename folder ! Rename folder
[ ] [ [ ] [
"日本語" [ create-folder ] [ "日本語" test-folder [ create-folder ] [
"ascii-name" [ rename-folder ] [ delete-folder ] bi "ascii-name" test-folder
[ rename-folder ] [ delete-folder ] bi
] bi ] bi
] imap-test ] imap-test
! Create a folder hierarchy ! Create a folder hierarchy
[ t ] [ [ t ] [
"*" list-folders length "*" test-folder list-folders length
"foo/bar/baz/日本語" [ "foo/bar/baz/日本語" test-folder [
create-folder "*" list-folders length 4 - = create-folder
"*" test-folder list-folders length 4 - =
] [ delete-folder ] bi ] [ delete-folder ] bi
] imap-test ] imap-test
! A gmail compliant way of creating a folder hierarchy. ! A gmail compliant way of creating a folder hierarchy.
[ ] [ [ ] [
"foo/bar/baz/boo" "/" split { } [ suffix ] cum-map [ "/" join ] map "foo/bar/baz/boo" test-folder "/" split
{ } [ suffix ] cum-map [ "/" join ] map
[ [ create-folder ] each ] [ [ delete-folder ] each ] bi [ [ create-folder ] each ] [ [ delete-folder ] each ] bi
] imap-test ] imap-test
[ ] [ [ ] [
"örjan" { "örjan" test-folder {
[ create-folder ] [ create-folder ]
[ select-folder drop ] [ select-folder drop ]
! Append mail with a seen flag ! Append mail with a seen flag