Commit 66d145ec authored by Pascal J. Bourguignon's avatar Pascal J. Bourguignon

Extracted test/property-list-p to reader-test.

parent 221b9eee
......@@ -32,7 +32,7 @@
;;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;;;**************************************************************************
(asdf:defsystem :com.informatimago.test
(asdf:defsystem :com.informatimago.tests
;; system attributes:
......
......@@ -208,12 +208,13 @@ License:
(when (verbose *verbose-tally*)
(let ((name-max-length 40))
(flet ((genline (name)
(format nil "~VA~3D ~9A~3D ~8A~5D ~A"
(format nil "~VA~5D ~A,~3D ~9A~:[,~3D ~8A~;~]."
name-max-length name
success-count (format nil "success~[es~;~:;es~]," success-count)
failure-count (format nil "failure~P," failure-count)
(+ success-count failure-count)
(format nil "test~P." (+ success-count failure-count)))))
(format nil "test~P" (+ success-count failure-count))
success-count (format nil "success~[es~;~:;es~]" success-count)
(zerop failure-count)
failure-count (format nil "failure~P" failure-count))))
(format *test-output* "~&~A~%"
(genline (current-test-identification name-max-length)))
(finish-output *test-output*)
......
......@@ -60,7 +60,8 @@
;; Utilities:
"POTENTIAL-NUMBER-P")
(:import-from "COM.INFORMATIMAGO.COMMON-LISP.LISP-READER.READER"
"EVAL-FEATURE")
"EVAL-FEATURE"
"PROPER-LIST-P")
(:export "TEST/ALL"
"TEST/READER"
"TEST/SYMBOLS"
......@@ -103,6 +104,40 @@ License:
(in-package "COM.INFORMATIMAGO.COMMON-LISP.LISP-READER.READER.TEST")
(define-test test/proper-list-p ()
(map nil (lambda (test) (test eq (proper-list-p (second test)) (first test)
((first test) (second test))))
'((nil x)
(t ())
(t (a))
(t (a b))
(t (a b c))
(t (a b c d))
(nil (a . x))
(nil (a b . x))
(nil (a b c . x))
(nil (a b c d . x))
(nil #1=(a . #1#))
(nil #2=(a b . #2#))
(nil #3=(a b c . #3#))
(nil #4=(a b c d . #4#))
(nil (1 . #1#))
(nil (1 2 . #1#))
(nil (1 2 3 . #1#))
(nil (1 2 3 4 . #1#))
(nil (1 . #2#))
(nil (1 2 . #2#))
(nil (1 2 3 . #2#))
(nil (1 2 3 4 . #2#))
(nil (1 . #3#))
(nil (1 2 . #3#))
(nil (1 2 3 . #3#))
(nil (1 2 3 4 . #3#))
(nil (1 . #4#))
(nil (1 2 . #4#))
(nil (1 2 3 . #4#))
(nil (1 2 3 4 . #4#)))))
(define-test test/reader ()
(let ((*read-base* 10)
(*read-eval* t)
......@@ -606,6 +641,7 @@ License:
(define-test test/all ()
(let ((*package* (find-package "COM.INFORMATIMAGO.COMMON-LISP.LISP-READER.READER.TEST")))
(test/proper-list-p)
(test/reader)
(test/symbols)
(test/features)
......
......@@ -1858,58 +1858,8 @@ NOTE: terminates with any kind of list, dotted, circular, etc.
(apply constructor arguments)))
;;;;
;;;;
(defun test-proper-list-p ()
(assert
(every
(function identity)
(mapcar (lambda (test) (eq (first test) (proper-list-p (second test))))
'((nil x)
(t ())
(t (a))
(t (a b))
(t (a b c))
(t (a b c d))
(nil (a . x))
(nil (a b . x))
(nil (a b c . x))
(nil (a b c d . x))
(nil #1=(a . #1#))
(nil #2=(a b . #2#))
(nil #3=(a b c . #3#))
(nil #4=(a b c d . #4#))
(nil (1 . #1#))
(nil (1 2 . #1#))
(nil (1 2 3 . #1#))
(nil (1 2 3 4 . #1#))
(nil (1 . #2#))
(nil (1 2 . #2#))
(nil (1 2 3 . #2#))
(nil (1 2 3 4 . #2#))
(nil (1 . #3#))
(nil (1 2 . #3#))
(nil (1 2 3 . #3#))
(nil (1 2 3 4 . #3#))
(nil (1 . #4#))
(nil (1 2 . #4#))
(nil (1 2 3 . #4#))
(nil (1 2 3 4 . #4#)))))))
;;;;
(defmethod initialize-instance
:after ((self readtable) &rest rest &key &allow-other-keys)
(defmethod initialize-instance :after ((self readtable) &rest rest &key &allow-other-keys)
(unless (getf rest :syntax-table)
(macrolet ((smc (&rest clauses)
`(progn
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment