X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fseq.pure.lisp;h=eb75013e8f1b15693071062ec3616cb0ee493400;hb=1ab1dd29f2602c87d404492e588abdf5f6abfbf2;hp=fcba6c902e69c5195f7133e032877f2d610c495b;hpb=1b6b3e70df90dca341b22f1f3229ca3887c27510;p=sbcl.git diff --git a/tests/seq.pure.lisp b/tests/seq.pure.lisp index fcba6c9..eb75013 100644 --- a/tests/seq.pure.lisp +++ b/tests/seq.pure.lisp @@ -11,6 +11,8 @@ ;;;; absolutely no warranty. See the COPYING and CREDITS files for ;;;; more information. +(in-package :cl-user) + ;;; As reported by Paul Dietz from his ansi-test suite for gcl, REMOVE ;;; malfunctioned when given :START, :END and :FROM-END arguments. ;;; Make sure it doesn't happen again. @@ -205,3 +207,38 @@ (b1 (make-array bsize :element-type '(unsigned-byte 8))) (b2 (make-array l :element-type '(unsigned-byte 8)))) (replace b1 b2 :start2 0 :end2 l)))))) + +(with-test (:name :bug-452008) + ;; FIND & POSITION on lists should check bounds and (in safe code) detect + ;; circular and dotted lists. + (macrolet ((test (type lambda) + `(let ((got (handler-case + (funcall (compile nil ',lambda)) + (,type () :error) + (:no-error (res) + (list :no-error res))))) + (let ((*print-circle* t)) + (format t "test: ~S~%" ',lambda)) + (unless (eq :error got) + (error "wanted an error, got ~S for~% ~S" + (second got) ',lambda))))) + (test sb-kernel:bounding-indices-bad-error + (lambda () + (find :foo '(1 2 3 :foo) :start 1 :end 5))) + (test sb-kernel:bounding-indices-bad-error + (lambda () + (position :foo '(1 2 3 :foo) :start 1 :end 5))) + (test sb-kernel:bounding-indices-bad-error + (lambda () + (find :foo '(1 2 3 :foo) :start 3 :end 0))) + (test sb-kernel:bounding-indices-bad-error + (lambda () + (position :foo '(1 2 3 :foo) :start 3 :end 0))) + (test type-error + (lambda () + (let ((list (list 1 2 3 :foo))) + (find :bar (nconc list list))))) + (test type-error + (lambda () + (let ((list (list 1 2 3 :foo))) + (position :bar (nconc list list)))))))