* test-rfc2368.el: New file.
authorkaoru <kaoru>
Sat, 21 Feb 2004 20:29:15 +0000 (20:29 +0000)
committerkaoru <kaoru>
Sat, 21 Feb 2004 20:29:15 +0000 (20:29 +0000)
tests/ChangeLog
tests/test-rfc2368.el [new file with mode: 0644]

index a1ac941..c66b412 100644 (file)
@@ -1,5 +1,7 @@
 2004-02-21  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
+       * test-rfc2368.el: New file.
+
        * test-elmo-util.el (test-elmo-number-set-member-1): Use `equal'.
        (test-elmo-number-set-member-2): New testcase.
 
diff --git a/tests/test-rfc2368.el b/tests/test-rfc2368.el
new file mode 100644 (file)
index 0000000..763ced2
--- /dev/null
@@ -0,0 +1,50 @@
+(require 'lunit)
+(require 'rfc2368)
+
+(luna-define-class test-rfc2368 (lunit-test-case))
+
+(luna-define-method test-rfc2368-parse-mailto-url-1 ((case test-rfc2368))
+  "To field only."
+  (lunit-assert
+   (equal
+    '(("To" . "chris@example.com"))
+    (rfc2368-parse-mailto-url "mailto:chris@example.com"))))
+
+(luna-define-method test-rfc2368-parse-mailto-url-2 ((case test-rfc2368))
+  "RFC2368 example in 2. Syntax of a mailto URL "
+  (lunit-assert
+   (equal
+    (rfc2368-parse-mailto-url "mailto:addr1%2C%20addr2")
+    (rfc2368-parse-mailto-url "mailto:?to=addr1%2C%20addr2")))
+  (lunit-assert
+   (equal
+    (rfc2368-parse-mailto-url "mailto:?to=addr1%2C%20addr2")
+    (rfc2368-parse-mailto-url "mailto:addr1?to=addr2"))))
+
+(luna-define-method test-rfc2368-parse-mailto-url-3 ((case test-rfc2368))
+  "With Subject field."
+  (lunit-assert
+   (equal
+    '(("To" . "infobot@example.com")
+      ("Subject" . "current-issue"))
+    (rfc2368-parse-mailto-url
+     "mailto:infobot@example.com?subject=current-issue"))))
+
+(luna-define-method test-rfc2368-parse-mailto-url-4 ((case test-rfc2368))
+  "Space in Subject field."
+  (lunit-assert
+   (equal
+    '(("To" . "infobot@example.com")
+      ("Body" . "send current-issue"))
+    (rfc2368-parse-mailto-url
+     "mailto:infobot@example.com?body=send%20current-issue"))))
+
+(luna-define-method test-rfc2368-parse-mailto-url-5 ((case test-rfc2368))
+  "CRLF in body."
+  (lunit-assert
+   (equal
+    '(("To" . "infobot@example.com")
+      ("Body" . "send current-issue\nsend index"))
+    (rfc2368-parse-mailto-url
+     (concat "mailto:infobot@example.com?body=send%20current-\n"
+            "issue%0D%0Asend%20index")))))