style(3p/lisp): expand tabs in npg, mime4cl and sclf
Done using
find third_party/lisp/{sclf,mime4cl,npg} \
-name '*.lisp' -or -name '*.asd' \
-exec bash -c 'expand -i -t 8 "$0" | sponge "$0"' {} \;
Change-Id: If84afac9c1d5cbc74e137a5aa0ae61472f0f1e90
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5066
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
40014c70b3
commit
25cb0ad32f
25 changed files with 2467 additions and 2467 deletions
104
third_party/lisp/mime4cl/test/endec.lisp
vendored
104
third_party/lisp/mime4cl/test/endec.lisp
vendored
|
|
@ -24,66 +24,66 @@
|
|||
|
||||
(deftest quoted-printable.1
|
||||
(encode-quoted-printable-sequence (map '(vector (unsigned-byte 8)) #'char-code
|
||||
"Français, Español, böse, skøl"))
|
||||
"Français, Español, böse, skøl"))
|
||||
"Fran=E7ais, Espa=F1ol, b=F6se, sk=F8l")
|
||||
|
||||
(deftest quoted-printable.2
|
||||
(encode-quoted-printable-sequence (map '(vector (unsigned-byte 8)) #'char-code
|
||||
"Français, Español, böse, skøl")
|
||||
:start 10 :end 17)
|
||||
"Français, Español, böse, skøl")
|
||||
:start 10 :end 17)
|
||||
"Espa=F1ol")
|
||||
|
||||
(deftest quoted-printable.3
|
||||
(map 'string #'code-char
|
||||
(decode-quoted-printable-string "Fran=E7ais, Espa=F1ol, b=F6se, sk=F8l"))
|
||||
(decode-quoted-printable-string "Fran=E7ais, Espa=F1ol, b=F6se, sk=F8l"))
|
||||
"Français, Español, böse, skøl")
|
||||
|
||||
(deftest quoted-printable.4
|
||||
(map 'string #'code-char
|
||||
(decode-quoted-printable-string "Fran=E7ais, Espa=F1ol, b=F6se, sk=F8l"
|
||||
:start 12 :end 21))
|
||||
(decode-quoted-printable-string "Fran=E7ais, Espa=F1ol, b=F6se, sk=F8l"
|
||||
:start 12 :end 21))
|
||||
"Español")
|
||||
|
||||
(deftest quoted-printable.5
|
||||
(map 'string #'code-char
|
||||
(decode-quoted-printable-string "this = wrong"))
|
||||
(decode-quoted-printable-string "this = wrong"))
|
||||
"this = wrong")
|
||||
|
||||
(deftest quoted-printable.6
|
||||
(map 'string #'code-char
|
||||
(decode-quoted-printable-string "this is wrong="))
|
||||
(decode-quoted-printable-string "this is wrong="))
|
||||
"this is wrong=")
|
||||
|
||||
(deftest quoted-printable.7
|
||||
(map 'string #'code-char
|
||||
(decode-quoted-printable-string "this is wrong=1"))
|
||||
(decode-quoted-printable-string "this is wrong=1"))
|
||||
"this is wrong=1")
|
||||
|
||||
(deftest quoted-printable.8
|
||||
(encode-quoted-printable-sequence (map '(vector (unsigned-byte 8)) #'char-code
|
||||
"x = x + 1"))
|
||||
"x = x + 1"))
|
||||
"x =3D x + 1")
|
||||
|
||||
(deftest quoted-printable.9
|
||||
(encode-quoted-printable-sequence (map '(vector (unsigned-byte 8)) #'char-code
|
||||
"x = x + 1 "))
|
||||
"x = x + 1 "))
|
||||
"x =3D x + 1 =20")
|
||||
|
||||
(deftest quoted-printable.10
|
||||
(encode-quoted-printable-sequence (map '(vector (unsigned-byte 8)) #'char-code
|
||||
"this string is very very very very very very very very very very very very very very very very very very very very long"))
|
||||
"this string is very very very very very very very very very very very very very very very very very very very very long"))
|
||||
"this string is very very very very very very very very very very very ve=
|
||||
ry very very very very very very very very long")
|
||||
|
||||
(deftest quoted-printable.11
|
||||
(encode-quoted-printable-sequence (map '(vector (unsigned-byte 8)) #'char-code
|
||||
"this string is very very very very long"))
|
||||
"this string is very very very very long"))
|
||||
"this string is very very =
|
||||
very very long")
|
||||
|
||||
(deftest quoted-printable.12
|
||||
(encode-quoted-printable-sequence (map '(vector (unsigned-byte 8)) #'char-code
|
||||
"please read the next
|
||||
"please read the next
|
||||
line"))
|
||||
"please read the next =20
|
||||
line")
|
||||
|
|
@ -93,24 +93,24 @@ line")
|
|||
(deftest base64.1
|
||||
(let ((*base64-line-length* nil))
|
||||
(encode-base64-sequence (map '(vector (unsigned-byte 8)) #'char-code
|
||||
"Some random string.")))
|
||||
"Some random string.")))
|
||||
"U29tZSByYW5kb20gc3RyaW5nLg==")
|
||||
|
||||
(deftest base64.2
|
||||
(let ((*base64-line-length* nil))
|
||||
(encode-base64-sequence (map '(vector (unsigned-byte 8)) #'char-code
|
||||
"Some random string.") :start 5 :end 11))
|
||||
"Some random string.") :start 5 :end 11))
|
||||
"cmFuZG9t")
|
||||
|
||||
(deftest base64.3
|
||||
(map 'string #'code-char
|
||||
(decode-base64-string "U29tZSByYW5kb20gc3RyaW5nLg=="))
|
||||
(decode-base64-string "U29tZSByYW5kb20gc3RyaW5nLg=="))
|
||||
"Some random string.")
|
||||
|
||||
(deftest base64.4
|
||||
(map 'string #'code-char
|
||||
(decode-base64-string "some rubbish U29tZSByYW5kb20gc3RyaW5nLg== more rubbish"
|
||||
:start 13 :end 41))
|
||||
(decode-base64-string "some rubbish U29tZSByYW5kb20gc3RyaW5nLg== more rubbish"
|
||||
:start 13 :end 41))
|
||||
"Some random string.")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
@ -121,47 +121,47 @@ line")
|
|||
|
||||
(defun perftest-encoder (encoder-class &optional (megs 100))
|
||||
(declare (optimize (speed 3) (debug 0) (safety 0))
|
||||
(type fixnum megs))
|
||||
(type fixnum megs))
|
||||
(with-open-file (in #P"/dev/random" :element-type '(unsigned-byte 8))
|
||||
(let* ((meg (* 1024 1024))
|
||||
(buffer (make-sequence '(vector (unsigned-byte 8)) meg))
|
||||
(encoder (make-instance encoder-class
|
||||
:output-function #'(lambda (c) (declare (ignore c))))))
|
||||
(buffer (make-sequence '(vector (unsigned-byte 8)) meg))
|
||||
(encoder (make-instance encoder-class
|
||||
:output-function #'(lambda (c) (declare (ignore c))))))
|
||||
(declare (type fixnum meg))
|
||||
(time
|
||||
(progn
|
||||
(dotimes (x megs)
|
||||
(read-sequence buffer in)
|
||||
(dotimes (i meg)
|
||||
(mime4cl:encoder-write-byte encoder (aref buffer i))))
|
||||
(mime4cl:encoder-finish-output encoder))))))
|
||||
(dotimes (x megs)
|
||||
(read-sequence buffer in)
|
||||
(dotimes (i meg)
|
||||
(mime4cl:encoder-write-byte encoder (aref buffer i))))
|
||||
(mime4cl:encoder-finish-output encoder))))))
|
||||
|
||||
(defun perftest-decoder (decoder-class &optional (megs 100))
|
||||
(declare (optimize (speed 3) (debug 0) (safety 0))
|
||||
(type fixnum megs))
|
||||
(type fixnum megs))
|
||||
(with-open-file (in #P"/dev/random" :element-type '(unsigned-byte 8))
|
||||
(let ((sclf:*tmp-file-defaults* (make-pathname :defaults #.(or *load-pathname* *compile-file-pathname*)
|
||||
:type "encoded-data")))
|
||||
:type "encoded-data")))
|
||||
(sclf:with-temp-file (tmp nil :direction :io)
|
||||
(let* ((meg (* 1024 1024))
|
||||
(buffer (make-sequence '(vector (unsigned-byte 8)) meg))
|
||||
(encoder-class (ecase decoder-class
|
||||
(mime4cl:base64-decoder 'mime4cl:base64-encoder)
|
||||
(mime4cl:quoted-printable-decoder 'mime4cl:quoted-printable-encoder)))
|
||||
(encoder (make-instance encoder-class
|
||||
:output-function #'(lambda (c)
|
||||
(write-char c tmp))))
|
||||
(decoder (make-instance decoder-class
|
||||
:input-function #'(lambda ()
|
||||
(read-char tmp nil)))))
|
||||
(declare (type fixnum meg))
|
||||
(dotimes (x megs)
|
||||
(read-sequence buffer in)
|
||||
(dotimes (i meg)
|
||||
(mime4cl:encoder-write-byte encoder (aref buffer i))))
|
||||
(mime4cl:encoder-finish-output encoder)
|
||||
(file-position tmp 0)
|
||||
(time
|
||||
(loop
|
||||
for b = (mime4cl:decoder-read-byte decoder)
|
||||
while b)))))))
|
||||
(let* ((meg (* 1024 1024))
|
||||
(buffer (make-sequence '(vector (unsigned-byte 8)) meg))
|
||||
(encoder-class (ecase decoder-class
|
||||
(mime4cl:base64-decoder 'mime4cl:base64-encoder)
|
||||
(mime4cl:quoted-printable-decoder 'mime4cl:quoted-printable-encoder)))
|
||||
(encoder (make-instance encoder-class
|
||||
:output-function #'(lambda (c)
|
||||
(write-char c tmp))))
|
||||
(decoder (make-instance decoder-class
|
||||
:input-function #'(lambda ()
|
||||
(read-char tmp nil)))))
|
||||
(declare (type fixnum meg))
|
||||
(dotimes (x megs)
|
||||
(read-sequence buffer in)
|
||||
(dotimes (i meg)
|
||||
(mime4cl:encoder-write-byte encoder (aref buffer i))))
|
||||
(mime4cl:encoder-finish-output encoder)
|
||||
(file-position tmp 0)
|
||||
(time
|
||||
(loop
|
||||
for b = (mime4cl:decoder-read-byte decoder)
|
||||
while b)))))))
|
||||
|
|
|
|||
24
third_party/lisp/mime4cl/test/mime.lisp
vendored
24
third_party/lisp/mime4cl/test/mime.lisp
vendored
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
(defvar *samples-directory*
|
||||
(merge-pathnames (make-pathname :directory '(:relative "samples"))
|
||||
#.(or *compile-file-pathname*
|
||||
*load-pathname*
|
||||
#P"")))
|
||||
#.(or *compile-file-pathname*
|
||||
*load-pathname*
|
||||
#P"")))
|
||||
|
||||
(defvar *sample1-file* (make-pathname :defaults #.(or *compile-file-pathname*
|
||||
*load-pathname*)
|
||||
|
|
@ -36,21 +36,21 @@
|
|||
|
||||
(deftest mime.1
|
||||
(let* ((orig (mime-message *sample1-file*))
|
||||
(dup (mime-message (with-output-to-string (out) (encode-mime-part orig out)))))
|
||||
(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"))
|
||||
:name :wild
|
||||
:type "txt"))
|
||||
do
|
||||
(format t "~A:~%" f)
|
||||
(finish-output)
|
||||
(let* ((orig (mime-message f))
|
||||
(dup (mime-message (with-output-to-string (out) (encode-mime-part orig out)))))
|
||||
(unless (mime= orig dup)
|
||||
(return nil)))
|
||||
(format t "~A:~%" f)
|
||||
(finish-output)
|
||||
(let* ((orig (mime-message f))
|
||||
(dup (mime-message (with-output-to-string (out) (encode-mime-part orig out)))))
|
||||
(unless (mime= orig dup)
|
||||
(return nil)))
|
||||
finally (return t))
|
||||
t)
|
||||
|
|
|
|||
2
third_party/lisp/mime4cl/test/package.lisp
vendored
2
third_party/lisp/mime4cl/test/package.lisp
vendored
|
|
@ -24,5 +24,5 @@
|
|||
|
||||
(defpackage :mime4cl-tests
|
||||
(:use :common-lisp
|
||||
:rtest :mime4cl)
|
||||
:rtest :mime4cl)
|
||||
(:export))
|
||||
|
|
|
|||
172
third_party/lisp/mime4cl/test/rt.lisp
vendored
172
third_party/lisp/mime4cl/test/rt.lisp
vendored
|
|
@ -23,8 +23,8 @@
|
|||
(:nicknames #:rtest #-lispworks #:rt)
|
||||
(:use #:cl)
|
||||
(:export #:*do-tests-when-defined* #:*test* #:continue-testing
|
||||
#:deftest #:do-test #:do-tests #:get-test #:pending-tests
|
||||
#:rem-all-tests #:rem-test)
|
||||
#:deftest #:do-test #:do-tests #:get-test #:pending-tests
|
||||
#:rem-all-tests #:rem-test)
|
||||
(:documentation "The MIT regression tester with pfdietz's modifications"))
|
||||
|
||||
(in-package :regression-test)
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
"A list of test names that are expected to fail.")
|
||||
|
||||
(defstruct (entry (:conc-name nil)
|
||||
(:type list))
|
||||
(:type list))
|
||||
pend name form)
|
||||
|
||||
(defmacro vals (entry) `(cdddr ,entry))
|
||||
|
|
@ -75,12 +75,12 @@
|
|||
|
||||
(defun get-entry (name)
|
||||
(let ((entry (find name (cdr *entries*)
|
||||
:key #'name
|
||||
:test #'equal)))
|
||||
:key #'name
|
||||
:test #'equal)))
|
||||
(when (null entry)
|
||||
(report-error t
|
||||
"~%No test with name ~:@(~S~)."
|
||||
name))
|
||||
name))
|
||||
entry))
|
||||
|
||||
(defmacro deftest (name form &rest values)
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
(setf (cdr l) (list entry))
|
||||
(return nil))
|
||||
(when (equal (name (cadr l))
|
||||
(name entry))
|
||||
(name entry))
|
||||
(setf (cadr l) entry)
|
||||
(report-error nil
|
||||
"Redefining test ~:@(~S~)"
|
||||
|
|
@ -105,10 +105,10 @@
|
|||
|
||||
(defun report-error (error? &rest args)
|
||||
(cond (*debug*
|
||||
(apply #'format t args)
|
||||
(if error? (throw '*debug* nil)))
|
||||
(error? (apply #'error args))
|
||||
(t (apply #'warn args))))
|
||||
(apply #'format t args)
|
||||
(if error? (throw '*debug* nil)))
|
||||
(error? (apply #'error args))
|
||||
(t (apply #'warn args))))
|
||||
|
||||
(defun do-test (&optional (name *test*))
|
||||
(do-entry (get-entry name)))
|
||||
|
|
@ -119,84 +119,84 @@
|
|||
((eq x y) t)
|
||||
((consp x)
|
||||
(and (consp y)
|
||||
(equalp-with-case (car x) (car y))
|
||||
(equalp-with-case (cdr x) (cdr y))))
|
||||
(equalp-with-case (car x) (car y))
|
||||
(equalp-with-case (cdr x) (cdr y))))
|
||||
((and (typep x 'array)
|
||||
(= (array-rank x) 0))
|
||||
(= (array-rank x) 0))
|
||||
(equalp-with-case (aref x) (aref y)))
|
||||
((typep x 'vector)
|
||||
(and (typep y 'vector)
|
||||
(let ((x-len (length x))
|
||||
(y-len (length y)))
|
||||
(and (eql x-len y-len)
|
||||
(loop
|
||||
for e1 across x
|
||||
for e2 across y
|
||||
always (equalp-with-case e1 e2))))))
|
||||
(let ((x-len (length x))
|
||||
(y-len (length y)))
|
||||
(and (eql x-len y-len)
|
||||
(loop
|
||||
for e1 across x
|
||||
for e2 across y
|
||||
always (equalp-with-case e1 e2))))))
|
||||
((and (typep x 'array)
|
||||
(typep y 'array)
|
||||
(not (equal (array-dimensions x)
|
||||
(array-dimensions y))))
|
||||
(typep y 'array)
|
||||
(not (equal (array-dimensions x)
|
||||
(array-dimensions y))))
|
||||
nil)
|
||||
((typep x 'array)
|
||||
(and (typep y 'array)
|
||||
(let ((size (array-total-size x)))
|
||||
(loop for i from 0 below size
|
||||
always (equalp-with-case (row-major-aref x i)
|
||||
(row-major-aref y i))))))
|
||||
(let ((size (array-total-size x)))
|
||||
(loop for i from 0 below size
|
||||
always (equalp-with-case (row-major-aref x i)
|
||||
(row-major-aref y i))))))
|
||||
(t (eql x y))))
|
||||
|
||||
(defun do-entry (entry &optional
|
||||
(s *standard-output*))
|
||||
(s *standard-output*))
|
||||
(catch '*in-test*
|
||||
(setq *test* (name entry))
|
||||
(setf (pend entry) t)
|
||||
(let* ((*in-test* t)
|
||||
;; (*break-on-warnings* t)
|
||||
(aborted nil)
|
||||
r)
|
||||
;; (*break-on-warnings* t)
|
||||
(aborted nil)
|
||||
r)
|
||||
;; (declare (special *break-on-warnings*))
|
||||
|
||||
(block aborted
|
||||
(setf r
|
||||
(flet ((%do
|
||||
()
|
||||
(if *compile-tests*
|
||||
(multiple-value-list
|
||||
(funcall (compile
|
||||
nil
|
||||
`(lambda ()
|
||||
(declare
|
||||
(optimize ,@*optimization-settings*))
|
||||
,(form entry)))))
|
||||
(multiple-value-list
|
||||
(eval (form entry))))))
|
||||
(if *catch-errors*
|
||||
(handler-bind
|
||||
((style-warning #'muffle-warning)
|
||||
(error #'(lambda (c)
|
||||
(setf aborted t)
|
||||
(setf r (list c))
|
||||
(return-from aborted nil))))
|
||||
(%do))
|
||||
(%do)))))
|
||||
(setf r
|
||||
(flet ((%do
|
||||
()
|
||||
(if *compile-tests*
|
||||
(multiple-value-list
|
||||
(funcall (compile
|
||||
nil
|
||||
`(lambda ()
|
||||
(declare
|
||||
(optimize ,@*optimization-settings*))
|
||||
,(form entry)))))
|
||||
(multiple-value-list
|
||||
(eval (form entry))))))
|
||||
(if *catch-errors*
|
||||
(handler-bind
|
||||
((style-warning #'muffle-warning)
|
||||
(error #'(lambda (c)
|
||||
(setf aborted t)
|
||||
(setf r (list c))
|
||||
(return-from aborted nil))))
|
||||
(%do))
|
||||
(%do)))))
|
||||
|
||||
(setf (pend entry)
|
||||
(or aborted
|
||||
(not (equalp-with-case r (vals entry)))))
|
||||
(or aborted
|
||||
(not (equalp-with-case r (vals entry)))))
|
||||
|
||||
(when (pend entry)
|
||||
(let ((*print-circle* *print-circle-on-failure*))
|
||||
(format s "~&Test ~:@(~S~) failed~
|
||||
(let ((*print-circle* *print-circle-on-failure*))
|
||||
(format s "~&Test ~:@(~S~) failed~
|
||||
~%Form: ~S~
|
||||
~%Expected value~P: ~
|
||||
~{~S~^~%~17t~}~%"
|
||||
*test* (form entry)
|
||||
(length (vals entry))
|
||||
(vals entry))
|
||||
(format s "Actual value~P: ~
|
||||
*test* (form entry)
|
||||
(length (vals entry))
|
||||
(vals entry))
|
||||
(format s "Actual value~P: ~
|
||||
~{~S~^~%~15t~}.~%"
|
||||
(length r) r)))))
|
||||
(length r) r)))))
|
||||
(when (not (pend entry)) *test*))
|
||||
|
||||
(defun continue-testing ()
|
||||
|
|
@ -205,50 +205,50 @@
|
|||
(do-entries *standard-output*)))
|
||||
|
||||
(defun do-tests (&optional
|
||||
(out *standard-output*))
|
||||
(out *standard-output*))
|
||||
(dolist (entry (cdr *entries*))
|
||||
(setf (pend entry) t))
|
||||
(if (streamp out)
|
||||
(do-entries out)
|
||||
(with-open-file
|
||||
(stream out :direction :output)
|
||||
(do-entries stream))))
|
||||
(stream out :direction :output)
|
||||
(do-entries stream))))
|
||||
|
||||
(defun do-entries (s)
|
||||
(format s "~&Doing ~A pending test~:P ~
|
||||
of ~A tests total.~%"
|
||||
(count t (cdr *entries*)
|
||||
:key #'pend)
|
||||
(length (cdr *entries*)))
|
||||
:key #'pend)
|
||||
(length (cdr *entries*)))
|
||||
(dolist (entry (cdr *entries*))
|
||||
(when (pend entry)
|
||||
(format s "~@[~<~%~:; ~:@(~S~)~>~]"
|
||||
(do-entry entry s))))
|
||||
(do-entry entry s))))
|
||||
(let ((pending (pending-tests))
|
||||
(expected-table (make-hash-table :test #'equal)))
|
||||
(expected-table (make-hash-table :test #'equal)))
|
||||
(dolist (ex *expected-failures*)
|
||||
(setf (gethash ex expected-table) t))
|
||||
(let ((new-failures
|
||||
(loop for pend in pending
|
||||
unless (gethash pend expected-table)
|
||||
collect pend)))
|
||||
(loop for pend in pending
|
||||
unless (gethash pend expected-table)
|
||||
collect pend)))
|
||||
(if (null pending)
|
||||
(format s "~&No tests failed.")
|
||||
(progn
|
||||
(format s "~&~A out of ~A ~
|
||||
(format s "~&No tests failed.")
|
||||
(progn
|
||||
(format s "~&~A out of ~A ~
|
||||
total tests failed: ~
|
||||
~:@(~{~<~% ~1:;~S~>~
|
||||
~^, ~}~)."
|
||||
(length pending)
|
||||
(length (cdr *entries*))
|
||||
pending)
|
||||
(if (null new-failures)
|
||||
(format s "~&No unexpected failures.")
|
||||
(when *expected-failures*
|
||||
(format s "~&~A unexpected failures: ~
|
||||
(length pending)
|
||||
(length (cdr *entries*))
|
||||
pending)
|
||||
(if (null new-failures)
|
||||
(format s "~&No unexpected failures.")
|
||||
(when *expected-failures*
|
||||
(format s "~&~A unexpected failures: ~
|
||||
~:@(~{~<~% ~1:;~S~>~
|
||||
~^, ~}~)."
|
||||
(length new-failures)
|
||||
new-failures)))
|
||||
))
|
||||
(length new-failures)
|
||||
new-failures)))
|
||||
))
|
||||
(null pending))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue