From 1e4b73ac957f30b57800533276a1f571d06f4f62 Mon Sep 17 00:00:00 2001 From: sterni Date: Mon, 1 May 2023 18:06:18 +0200 Subject: refactor(3p/lisp/mime4cl): unify test mechanism for sample msgs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For whatever reason, there were two sort of identical tests, mime.1 and mime.2, in the mime4cl test suite: The former tested *sample1-file* and the latter all messages *samples-directory*—in the same way, parsing the original and a re-rendered version of the message to check if they were equal. We can just move sample1.msg into *samples-directory*, get rid of *sample1-file* and thus pave the way for more test messages in the future. Change-Id: I843be331682b731af6ae02a4648ba1c64aaf59a5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8546 Reviewed-by: sterni Autosubmit: sterni Tested-by: BuildkiteCI --- third_party/lisp/mime4cl/default.nix | 6 +- third_party/lisp/mime4cl/test/mime.lisp | 15 +--- third_party/lisp/mime4cl/test/sample1.msg | 86 ----------------------- third_party/lisp/mime4cl/test/samples/sample1.msg | 86 +++++++++++++++++++++++ 4 files changed, 90 insertions(+), 103 deletions(-) delete mode 100644 third_party/lisp/mime4cl/test/sample1.msg create mode 100644 third_party/lisp/mime4cl/test/samples/sample1.msg (limited to 'third_party/lisp/mime4cl') diff --git a/third_party/lisp/mime4cl/default.nix b/third_party/lisp/mime4cl/default.nix index 06831640968f..f276e9f8e77c 100644 --- a/third_party/lisp/mime4cl/default.nix +++ b/third_party/lisp/mime4cl/default.nix @@ -29,10 +29,8 @@ depot.nix.buildLisp.library { (pkgs.writeText "nix-samples.lisp" '' (in-package :mime4cl-tests) - ;; missing from the tarball completely - (defvar *samples-directory* (pathname "/this/does/not/exist")) - ;; override auto discovery which doesn't work in store - (defvar *sample1-file* (pathname "${./test/sample1.msg}")) + ;; override auto discovery which doesn't work in the nix store + (defvar *samples-directory* (pathname "${./test/samples}")) '') ./test/temp-file.lisp ./test/endec.lisp diff --git a/third_party/lisp/mime4cl/test/mime.lisp b/third_party/lisp/mime4cl/test/mime.lisp index 8d9397859994..2b87c9e5a4ff 100644 --- a/third_party/lisp/mime4cl/test/mime.lisp +++ b/third_party/lisp/mime4cl/test/mime.lisp @@ -1,7 +1,7 @@ ;;; mime.lisp --- MIME regression tests ;;; Copyright (C) 2012 by Walter C. Pelissero -;;; Copyright (C) 2021-2022 by the TVL Authors +;;; Copyright (C) 2021-2023 by the TVL Authors ;;; Author: Walter C. Pelissero ;;; Project: mime4cl @@ -27,22 +27,11 @@ *load-pathname* #P""))) -(defvar *sample1-file* (make-pathname :defaults #.(or *compile-file-pathname* - *load-pathname*) - :name "sample1" - :type "msg")) - (deftest mime.1 - (let* ((orig (mime-message *sample1-file*)) - (dup (mime-message (with-output-to-string (out) (encode-mime-part orig out))))) - (mime= orig dup)) - t) - -(deftest mime.2 (loop for f in (directory (make-pathname :defaults *samples-directory* :name :wild - :type "txt")) + :type "msg")) do (format t "~A:~%" f) (finish-output) diff --git a/third_party/lisp/mime4cl/test/sample1.msg b/third_party/lisp/mime4cl/test/sample1.msg deleted file mode 100644 index 662a9fab341e..000000000000 --- a/third_party/lisp/mime4cl/test/sample1.msg +++ /dev/null @@ -1,86 +0,0 @@ -From wcp@scylla.home.lan Fri Feb 17 11:02:28 2012 -Status: RO -X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil] - ["1133" "Friday" "17" "February" "2012" "11:02:27" "+0100" "Walter C. Pelissero" "walter@pelissero.de" nil "56" "test" "^From:" nil nil "2" nil nil nil nil nil nil nil nil nil nil] - nil) -X-Clpmr-Processed: 2012-02-17T11:02:31 -X-Clpmr-Version: 2011-10-23T12:55:20, SBCL 1.0.49 -Received: from scylla.home.lan (localhost [127.0.0.1]) - by scylla.home.lan (8.14.5/8.14.5) with ESMTP id q1HA2Sik004513 - for ; Fri, 17 Feb 2012 11:02:28 +0100 (CET) - (envelope-from wcp@scylla.home.lan) -Received: (from wcp@localhost) - by scylla.home.lan (8.14.5/8.14.5/Submit) id q1HA2SqU004512; - Fri, 17 Feb 2012 11:02:28 +0100 (CET) - (envelope-from wcp) -Message-ID: <20286.9651.890757.323027@scylla.home.lan> -X-Mailer: VM 8.1.1 under 23.3.1 (amd64-portbld-freebsd8.2) -Reply-To: walter@pelissero.de -X-Attribution: WP -X-For-Spammers: blacklistme@pelissero.de -X-MArch-Processing-Time: 0.552s -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="615CiWUaGO" -Content-Transfer-Encoding: 7BIT -From: walter@pelissero.de (Walter C. Pelissero) -To: wcp@scylla.home.lan -Subject: test -Date: Fri, 17 Feb 2012 11:02:27 +0100 - - ---615CiWUaGO -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7BIT -Content-Description: message body text - -Hereafter three attachments. - -The first: - ---615CiWUaGO -Content-Type: application/octet-stream; name="attach1" -Content-Transfer-Encoding: BASE64 -Content-Disposition: attachment; filename="attach1" - -YXR0YWNoMQo= - ---615CiWUaGO -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7BIT -Content-Description: message body text - - -The second: - ---615CiWUaGO -Content-Type: application/octet-stream; name="attach2" -Content-Transfer-Encoding: BASE64 -Content-Disposition: attachment; filename="attach2" - -YXR0YWNoMgo= - ---615CiWUaGO -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7BIT -Content-Description: message body text - - -The third: - ---615CiWUaGO -Content-Type: application/octet-stream; name="attach3" -Content-Transfer-Encoding: BASE64 -Content-Disposition: attachment; filename="attach3" - -YXR0YWNoMwo= - ---615CiWUaGO -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7BIT -Content-Description: .signature - - --- -http://pelissero.de ---615CiWUaGO-- - diff --git a/third_party/lisp/mime4cl/test/samples/sample1.msg b/third_party/lisp/mime4cl/test/samples/sample1.msg new file mode 100644 index 000000000000..662a9fab341e --- /dev/null +++ b/third_party/lisp/mime4cl/test/samples/sample1.msg @@ -0,0 +1,86 @@ +From wcp@scylla.home.lan Fri Feb 17 11:02:28 2012 +Status: RO +X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil] + ["1133" "Friday" "17" "February" "2012" "11:02:27" "+0100" "Walter C. Pelissero" "walter@pelissero.de" nil "56" "test" "^From:" nil nil "2" nil nil nil nil nil nil nil nil nil nil] + nil) +X-Clpmr-Processed: 2012-02-17T11:02:31 +X-Clpmr-Version: 2011-10-23T12:55:20, SBCL 1.0.49 +Received: from scylla.home.lan (localhost [127.0.0.1]) + by scylla.home.lan (8.14.5/8.14.5) with ESMTP id q1HA2Sik004513 + for ; Fri, 17 Feb 2012 11:02:28 +0100 (CET) + (envelope-from wcp@scylla.home.lan) +Received: (from wcp@localhost) + by scylla.home.lan (8.14.5/8.14.5/Submit) id q1HA2SqU004512; + Fri, 17 Feb 2012 11:02:28 +0100 (CET) + (envelope-from wcp) +Message-ID: <20286.9651.890757.323027@scylla.home.lan> +X-Mailer: VM 8.1.1 under 23.3.1 (amd64-portbld-freebsd8.2) +Reply-To: walter@pelissero.de +X-Attribution: WP +X-For-Spammers: blacklistme@pelissero.de +X-MArch-Processing-Time: 0.552s +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="615CiWUaGO" +Content-Transfer-Encoding: 7BIT +From: walter@pelissero.de (Walter C. Pelissero) +To: wcp@scylla.home.lan +Subject: test +Date: Fri, 17 Feb 2012 11:02:27 +0100 + + +--615CiWUaGO +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7BIT +Content-Description: message body text + +Hereafter three attachments. + +The first: + +--615CiWUaGO +Content-Type: application/octet-stream; name="attach1" +Content-Transfer-Encoding: BASE64 +Content-Disposition: attachment; filename="attach1" + +YXR0YWNoMQo= + +--615CiWUaGO +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7BIT +Content-Description: message body text + + +The second: + +--615CiWUaGO +Content-Type: application/octet-stream; name="attach2" +Content-Transfer-Encoding: BASE64 +Content-Disposition: attachment; filename="attach2" + +YXR0YWNoMgo= + +--615CiWUaGO +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7BIT +Content-Description: message body text + + +The third: + +--615CiWUaGO +Content-Type: application/octet-stream; name="attach3" +Content-Transfer-Encoding: BASE64 +Content-Disposition: attachment; filename="attach3" + +YXR0YWNoMwo= + +--615CiWUaGO +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7BIT +Content-Description: .signature + + +-- +http://pelissero.de +--615CiWUaGO-- + -- cgit 1.4.1