# While most of SBCL is derived from the CMU CL system, the test
# files (like this one) were written from scratch after the fork
# from CMU CL.
-#
+#
# This software is in the public domain and is provided with
# absolutely no warranty. See the COPYING and CREDITS files for
# more information.
-# Check that compiling and loading the file $1 generates an error
-# at load time; also that just loading it directly (into the
-# interpreter) generates an error.
-expect_load_error ()
-{
- # Test compiling and loading.
- $SBCL <<EOF
- (compile-file "$1")
- ;;; But loading the file should fail.
- (multiple-value-bind (value0 value1) (ignore-errors (load *))
- (assert (null value0))
- (format t "VALUE1=~S (~A)~%" value1 value1)
- (assert (typep value1 'error)))
- (sb-ext:quit :unix-status 52)
-EOF
- if [ $? != 52 ]; then
- echo compile-and-load $1 test failed: $?
- exit 1
- fi
+. ./expect.sh
- # Test loading into the interpreter.
- $SBCL <<EOF
- (multiple-value-bind (value0 value1) (ignore-errors (load "$1"))
- (assert (null value0))
- (format t "VALUE1=~S (~A)~%" value1 value1)
- (assert (typep value1 'error)))
- (sb-ext:quit :unix-status 52)
-EOF
- if [ $? != 52 ]; then
- echo load-into-interpreter $1 test failed: $?
- exit 1
- fi
-}
+use_test_subdirectory
-tmpfilename="clos-test-$$-tmp.lisp"
+tmpfilename="$TEST_FILESTEM.lisp"
# This should fail, but didn't until sbcl-0.6.12.7, with Martin
# Atzmueller's port of Pierre Mai's fixes.
;; This definition has too many qualifiers, so loading the
;; DEFMETHOD should fail.
(defmethod zut progn :around ((x integer)) (print "integer"))
+ (zut 1)
EOF
expect_load_error $tmpfilename
;; This definition is missing the PROGN qualifier, and so the
;; DEFMETHOD should fail.
(defmethod zut ((x integer)) (print "integer"))
+ (zut 1)
EOF
expect_load_error $tmpfilename
;; This definition has too many qualifiers, so loading the
;; DEFMETHOD should fail.
(defmethod zut progn :around ((x integer)) (print "integer"))
+ (zut 1)
EOF
expect_load_error $tmpfilename
-rm $tmpfilename
+# Until sbcl-0.7.6.21, PCL signalled spurious STYLE-WARNINGs on
+# compilation of this form; the report (bug #191a.) and a patch
+# suppressing these were provided by Alexey Dejenka in quick
+# succession.
+cat > $tmpfilename <<EOF
+ (in-package :cl-user)
+ (defclass another-class-with-slots ()
+ (a-new-slot-name))
+ (defun foo (x)
+ (values (setf (slot-value x 'a-new-slot-name) 2)
+ (slot-value x 'a-new-slot-name)))
+EOF
+expect_clean_compile $tmpfilename
-# success
-exit 104
+# success
+exit $EXIT_TEST_WIN