1.0.17.4: support for dynamic-extent structures
[sbcl.git] / tests / compiler.test.sh
index 25c208c..548f9ee 100644 (file)
@@ -6,16 +6,16 @@
 # 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.
 
 . ./expect.sh
 
-base_tmpfilename="compiler-test-$$-tmp"
-tmpfilename="$base_tmpfilename.lisp"
-compiled_tmpfilename="$base_tmpfilename.fasl"
+use_test_subdirectory
+
+tmpfilename="$TEST_FILESTEM.lisp"
 
 # This should fail, as type inference should show that the call to FOO
 # will return something of the wrong type.
@@ -39,11 +39,11 @@ expect_failed_compile $tmpfilename
 # having the same name.
 cat > $tmpfilename <<EOF
     (in-package :cl-user)
-    (defun foo (x) 
+    (defun foo (x)
       (flet ((baz (y) (load y)))
         (declare (notinline baz))
         (baz x)))
-    (defun bar (x) 
+    (defun bar (x)
       (flet ((baz (y) (load y)))
         (declare (notinline baz))
         (baz x)))
@@ -93,7 +93,7 @@ expect_clean_compile $tmpfilename
 cat > $tmpfilename <<EOF
     (in-package :cl-user)
     (defun foo (x) (list x))
-    (defun bar (x) 
+    (defun bar (x)
       (declare (notinline foo))
       (1+ (foo x)))
 EOF
@@ -161,13 +161,16 @@ fail_on_compiler_note $tmpfilename
 # test case from Rudi for some CLOS WARNINGness that shouldn't have
 # been there
 cat > $tmpfilename <<EOF
+    #+sb-eval (eval-when (:compile-toplevel)
+                (setf sb-ext:*evaluator-mode* :compile))
+
     (eval-when (:compile-toplevel :load-toplevel :execute)
-      (defstruct buffer-state 
+      (defstruct buffer-state
         (output-index 0)))
-    
+
     (defclass buffered-stream-mixin ()
       ((buffer-state :initform (make-buffer-state))))
-    
+
     (defgeneric frob (stream))
     (defmethod frob ((stream t))
       nil)
@@ -320,7 +323,7 @@ expect_clean_compile $tmpfilename
 cat > $tmpfilename <<EOF
 (defun bar ()
   (let ((result ""))
-    (nreverse result)))  
+    (nreverse result)))
 EOF
 expect_clean_compile $tmpfilename
 
@@ -344,8 +347,42 @@ cat > $tmpfilename <<EOF
 EOF
 expect_failed_compile $tmpfilename
 
-rm $tmpfilename
-rm $compiled_tmpfilename
+cat > $tmpfilename <<EOF
+(declaim (optimize (speed 3) (space 0) (safety 0)))
+
+(defun foo (bar)
+  (last bar))
+EOF
+expect_clean_compile $tmpfilename
+
+cat > $tmpfilename <<EOF
+(defstruct foo
+  (bar #p"/tmp/"))
+EOF
+expect_clean_compile $tmpfilename
+
+cat > $tmpfilename <<EOF
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (defstruct foox)
+  (defmethod make-load-form ((foo foox) &optional env)
+    (declare (ignore env))
+    '(make-foox)))
+(defstruct bar
+  (foo #.(make-foox)))
+EOF
+expect_clean_compile $tmpfilename
+
+cat > $tmpfilename <<EOF
+(defun something (x) x)
+...
+(defun something-more (x) x)
+EOF
+expect_aborted_compile $tmpfilename
+
+cat > $tmpfilename <<EOF
+(if t (locally))
+EOF
+expect_clean_cload $tmpfilename
 
-# success 
-exit 104
+# success
+exit $EXIT_TEST_WIN