grovel-headers.c: Put win32 stuff into grovel-headers-win32.h.
[sbcl.git] / tests / load.pure.lisp
blobef3d2bfab462c105674765a6ae1d6a077c9cca25
1 ;;;; miscellaneous tests of LOOP-related stuff
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
8 ;;;; from CMU CL.
9 ;;;;
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
14 (in-package "CL-USER")
16 ;;; As reported by Gregory Wright sbcl-devel 2002-07-15, SBCL 0.7.5
17 ;;; didn't honor the LOAD :IF-DOES-NOT-EXIST argument when the type of
18 ;;; the LOADed file was specified.
19 (load "i-am-not" :if-does-not-exist nil)
20 (load "i-am-not.lisp" :if-does-not-exist nil)
21 (load "i-am-not.fasl" :if-does-not-exist nil)
22 (load "i-am-not.misc-garbage" :if-does-not-exist nil)
24 ;;; In 1.0.17, LOAD didn't error when the file didn't exist and
25 ;;; IF-DOES-NOT-EXIST was true.
26 (assert (typep (nth-value 1 (ignore-errors (load "i-am-not"))) 'file-error))
27 (assert (typep (nth-value 1 (ignore-errors (load "i-am-not" :if-does-not-exist t))) 'file-error))
29 ;; These tests are essentially the same as in compiler.pure.lisp
30 (with-test (:name :load-as-source-error-position-reporting)
31 ;; These test errors that occur during READ
32 (dolist (input '("data/wonky1.lisp" "data/wonky2.lisp" "data/wonky3.lisp"))
33 (let ((expect (with-open-file (f input) (read f))))
34 (assert (stringp expect))
35 (let ((err-string
36 (block foo
37 ;; you can't query the stream position with HANDLER-CASE
38 ;; because it closes before the condition is formatted.
39 (handler-bind ((error (lambda (c)
40 (return-from foo
41 (write-to-string c :escape nil)))))
42 (load input)))))
43 (assert (search expect err-string)))))
45 ;; This tests an error that occur during EVAL
46 (let ((s (with-output-to-string (*error-output*)
47 (handler-bind ((error #'abort)) (load "data/wonky4.lisp")))))
48 (assert (search "While evaluating the form starting at line 16, column 1"
49 s))))