From 88c0028d13d95882e7261a692e521e3cfa1989f8 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Fri, 25 Apr 2014 21:29:41 -0700 Subject: [PATCH] imap: try and make tests work from multiple builders at the same time. --- extra/imap/imap-tests.factor | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/extra/imap/imap-tests.factor b/extra/imap/imap-tests.factor index 80e136a0bb..1bb9a189bb 100644 --- a/extra/imap/imap-tests.factor +++ b/extra/imap/imap-tests.factor @@ -1,7 +1,9 @@ -USING: accessors arrays assocs calendar calendar.format combinators -continuations formatting fry grouping.extras imap io.streams.duplex kernel -math math.parser math.ranges math.statistics namespaces pcre random sequences -sets sorting strings tools.test ; +USING: accessors arrays assocs calendar calendar.format +combinators continuations formatting fry grouping.extras imap +io.streams.duplex kernel math math.parser math.ranges +math.statistics namespaces random sequences sets sorting +splitting strings system tools.test ; +FROM: pcre => findall ; IN: imap.tests : random-ascii ( n -- str ) @@ -61,9 +63,16 @@ ERROR: no-imap-test-host ; "ALL" "" search-mails ] imap-test +: base-folder ( -- s ) + os name>> cpu name>> "-" glue ; + +: test-folder ( s -- s ) + [ base-folder "/" ] dip 3append ; + ! Create delete select again. [ 0 ] [ - "örjan" [ create-folder ] [ select-folder ] [ delete-folder ] tri + "örjan" test-folder + [ create-folder ] [ select-folder ] [ delete-folder ] tri ] imap-test ! Test list folders @@ -110,27 +119,30 @@ ERROR: no-imap-test-host ; ! Rename folder [ ] [ - "日本語" [ create-folder ] [ - "ascii-name" [ rename-folder ] [ delete-folder ] bi + "日本語" test-folder [ create-folder ] [ + "ascii-name" test-folder + [ rename-folder ] [ delete-folder ] bi ] bi ] imap-test ! Create a folder hierarchy [ t ] [ - "*" list-folders length - "foo/bar/baz/日本語" [ - create-folder "*" list-folders length 4 - = + "*" test-folder list-folders length + "foo/bar/baz/日本語" test-folder [ + create-folder + "*" test-folder list-folders length 4 - = ] [ delete-folder ] bi ] imap-test ! 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 ] imap-test [ ] [ - "örjan" { + "örjan" test-folder { [ create-folder ] [ select-folder drop ] ! Append mail with a seen flag