# 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
-# Test that a file compiles cleanly, with no ERRORs, WARNINGs or
-# STYLE-WARNINGs.
-#
-# Maybe this wants to be in a compiler.test.sh script? This function
-# was originally written to test APD's patch for slot readers and
-# writers not being known to the compiler. -- CSR, 2002-08-14
-expect_clean_compile ()
-{
- $SBCL <<EOF
- (multiple-value-bind (pathname warnings-p failure-p)
- (compile-file "$1")
- (declare (ignore pathname))
- (assert (not warnings-p))
- (assert (not failure-p))
- (sb-ext:quit :unix-status 52))
-EOF
- if [ $? != 52 ]; then
- echo clean-compile $1 test failed: $?
- exit 1
- fi
-}
-
-base_tmpfilename="clos-test-$$-tmp"
-tmpfilename="$base_tmpfilename.lisp"
-compiled_tmpfilename="$base_tmpfilename.fasl"
+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
# succession.
cat > $tmpfilename <<EOF
(in-package :cl-user)
- (defclass another-class-with-slots ()
+ (defclass another-class-with-slots ()
(a-new-slot-name))
(defun foo (x)
(values (setf (slot-value x 'a-new-slot-name) 2)
EOF
expect_clean_compile $tmpfilename
-rm $tmpfilename
-rm $compiled_tmpfilename
-
-# success
-exit 104
+# success
+exit $EXIT_TEST_WIN