c21707b7f7f32245626a8b9774ae590e56d7b3b0
[elisp/wanderlust.git] / tests / check-base64.el
1 (require 'lunit)
2
3 (luna-define-class check-base64 (lunit-test-case))
4
5 ;; mel-b-ccl on XEmacs 21.1
6 ;;  <http://lists.airs.net/wl/archive/200101/msg00075.html>
7 (luna-define-method check-base64-encode-1 ((case check-base64))
8   (require 'elmo-util)
9   (lunit-assert
10    (string=
11     "QQ=="
12     (elmo-base64-encode-string "A"))))
13
14 (luna-define-method check-base64-encode-2 ((case check-base64))
15   (require 'elmo-util)
16   (lunit-assert
17    (string=
18     "QUE="
19     (elmo-base64-encode-string "AA"))))
20
21 (luna-define-method check-base64-encode-3 ((case check-base64))
22   (require 'elmo-util)
23   (lunit-assert
24    (string=
25     "QUFB"
26     (elmo-base64-encode-string "AAA"))))
27
28 ;; Old base64 module on XEmacs 21.1
29 ;;  <http://lists.airs.net/wl/archive/200104/msg00150.html>
30 (defun check-base64-encode-string-has-no-line-break-argument ()
31   (require 'elmo-util)
32   (condition-case nil
33       (elmo-base64-encode-string "" t)
34     (wrong-number-of-arguments)))
35
36 (luna-define-method check-base64-encode-4 ((case check-base64))
37   (lunit-assert
38    (check-base64-encode-string-has-no-line-break-argument)))
39
40 ;;  <http://lists.airs.net/wl/archive/200107/msg00121.html>
41
42 (defun check-base64-encode-region-has-no-line-break-argument ()
43   (require 'mel)
44   (condition-case nil
45       (with-temp-buffer
46         (funcall (mel-find-function 'mime-encode-region "base64")
47                  (point-min) (point-max) t)
48         t)
49     (wrong-number-of-arguments)))
50
51 (luna-define-method check-base64-encode-5 ((case check-base64))
52   (lunit-assert
53    (check-base64-encode-region-has-no-line-break-argument)))
54