* test-elmo-imap4.el: New file.
authorkaoru <kaoru>
Sat, 1 Aug 2009 09:40:15 +0000 (09:40 +0000)
committerkaoru <kaoru>
Sat, 1 Aug 2009 09:40:15 +0000 (09:40 +0000)
(test-elmo-imap4-parse-greeting-ok): New testcase.
(test-elmo-imap4-parse-greeting-preauth): Ditto.
(test-elmo-imap4-parse-greeting-bye): Ditto.

tests/ChangeLog
tests/test-elmo-imap4.el [new file with mode: 0644]

index ade64ef..9f8c6ed 100644 (file)
@@ -1,5 +1,10 @@
 2009-08-01  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
+       * test-elmo-imap4.el: New file.
+       (test-elmo-imap4-parse-greeting-ok): New testcase.
+       (test-elmo-imap4-parse-greeting-preauth): Ditto.
+       (test-elmo-imap4-parse-greeting-bye): Ditto.
+
        * test-utf7.el (toplevel): Use `fboundp' instead of `boundp'.
        Fix (require 'utf7) order for Mule-UCS.
        (test-utf7-decode-string-plus): New testcase.
diff --git a/tests/test-elmo-imap4.el b/tests/test-elmo-imap4.el
new file mode 100644 (file)
index 0000000..bbb824e
--- /dev/null
@@ -0,0 +1,33 @@
+(require 'lunit)
+(require 'elmo-imap4)
+
+(luna-define-class test-elmo-imap4 (lunit-test-case))
+
+(luna-define-method test-elmo-imap4-parse-greeting-ok ((case test-elmo-imap4))
+  (with-temp-buffer
+    (setq case-fold-search nil)
+    (let (elmo-imap4-status)
+      (insert-string "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID"
+                    " LOGINDISABLED AUTH=DIGEST-MD5 AUTH=CRAM-MD5 SASL-IR]"
+                    " mail.example.org Cyrus IMAP v2.3.13 server ready\n")
+      (goto-char (point-min))
+      (lunit-assert
+       (eq 'nonauth (elmo-imap4-parse-greeting))))))
+
+(luna-define-method test-elmo-imap4-parse-greeting-preauth ((case test-elmo-imap4))
+  (with-temp-buffer
+    (setq case-fold-search nil)
+    (let (elmo-imap4-status)
+      (insert-string "* PREAUTH IMAP4rev1 server logged in as Smith\n")
+      (goto-char (point-min))
+      (lunit-assert
+       (eq 'auth (elmo-imap4-parse-greeting))))))
+
+(luna-define-method test-elmo-imap4-parse-greeting-bye ((case test-elmo-imap4))
+  (with-temp-buffer
+    (setq case-fold-search nil)
+    (let (elmo-imap4-status)
+      (insert-string "* BYE LOGOUT received\n")
+      (goto-char (point-min))
+      (lunit-assert
+       (eq 'closed (elmo-imap4-parse-greeting))))))