test(3p/lisp/mime4cl): test decoding RFC2047 examples
Change-Id: I32abb00e8cec697adb45b9a175cd753e807d33d5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8588 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
8fa67a0d6f
commit
7f99eb44a5
3 changed files with 22 additions and 2 deletions
2
third_party/lisp/mime4cl/endec.lisp
vendored
2
third_party/lisp/mime4cl/endec.lisp
vendored
|
@ -650,7 +650,7 @@ sequence, a charset string indicating the original coding."
|
||||||
|
|
||||||
(defun decode-RFC2047 (text)
|
(defun decode-RFC2047 (text)
|
||||||
"Decode TEXT into a fully decoded string. Whenever a non ASCII part is
|
"Decode TEXT into a fully decoded string. Whenever a non ASCII part is
|
||||||
encountered, try to decode it using babel, otherwise signal an error."
|
encountered, try to decode it using flexi-streams, otherwise signal an error."
|
||||||
(flet ((decode-part (part)
|
(flet ((decode-part (part)
|
||||||
(etypecase part
|
(etypecase part
|
||||||
(cons (flexi-streams:octets-to-string
|
(cons (flexi-streams:octets-to-string
|
||||||
|
|
1
third_party/lisp/mime4cl/package.lisp
vendored
1
third_party/lisp/mime4cl/package.lisp
vendored
|
@ -69,6 +69,7 @@
|
||||||
#:encode-base64-stream
|
#:encode-base64-stream
|
||||||
#:encode-base64-sequence
|
#:encode-base64-sequence
|
||||||
#:parse-RFC2047-text
|
#:parse-RFC2047-text
|
||||||
|
#:decode-RFC2047
|
||||||
#:parse-RFC822-header
|
#:parse-RFC822-header
|
||||||
#:read-RFC822-headers
|
#:read-RFC822-headers
|
||||||
#:time-RFC822-string
|
#:time-RFC822-string
|
||||||
|
|
21
third_party/lisp/mime4cl/test/endec.lisp
vendored
21
third_party/lisp/mime4cl/test/endec.lisp
vendored
|
@ -116,7 +116,26 @@ line")
|
||||||
(deftest RFC2047.1
|
(deftest RFC2047.1
|
||||||
(parse-RFC2047-text "foo bar")
|
(parse-RFC2047-text "foo bar")
|
||||||
("foo bar"))
|
("foo bar"))
|
||||||
;; TODO(sterni): more RFC2047 test cases
|
|
||||||
|
;; from RFC2047 section 8
|
||||||
|
(deftest RFC2047.2
|
||||||
|
(decode-RFC2047 "=?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu>")
|
||||||
|
"Keith Moore <moore@cs.utk.edu>")
|
||||||
|
|
||||||
|
;; from RFC2047 section 8
|
||||||
|
(deftest RFC2047.3
|
||||||
|
(decode-RFC2047 "=?ISO-8859-1?Q?Olle_J=E4rnefors?=")
|
||||||
|
"Olle Järnefors")
|
||||||
|
|
||||||
|
;; from RFC2047 section 8
|
||||||
|
(deftest RFC2047.4
|
||||||
|
(decode-RFC2047 "Nathaniel Borenstein <nsb@thumper.bellcore.com> (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)")
|
||||||
|
"Nathaniel Borenstein <nsb@thumper.bellcore.com> (םולש ןב ילטפנ)")
|
||||||
|
|
||||||
|
;; from RFC2047 section 8
|
||||||
|
(deftest RFC2047.5
|
||||||
|
(decode-RFC2047 "=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>")
|
||||||
|
"Keld Jørn Simonsen <keld@dkuug.dk>")
|
||||||
|
|
||||||
(defun perftest-encoder (encoder-class &optional (megs 100))
|
(defun perftest-encoder (encoder-class &optional (megs 100))
|
||||||
(declare (optimize (speed 3) (debug 0) (safety 0))
|
(declare (optimize (speed 3) (debug 0) (safety 0))
|
||||||
|
|
Loading…
Reference in a new issue