[Git][cmucl/cmucl][master] 2 commits: Fix #333: LOAD :IF-DOES-NOT-EXIST is a generalized boolean

Raymond Toy pushed to branch master at cmucl / cmucl Commits: decda1f5 by Raymond Toy at 2024-07-14T12:34:05+00:00 Fix #333: LOAD :IF-DOES-NOT-EXIST is a generalized boolean - - - - - 5c8483f8 by Raymond Toy at 2024-07-14T12:34:13+00:00 Merge branch 'issue-333-load-if-does-not-exist' into 'master' Fix #333: LOAD :IF-DOES-NOT-EXIST is a generalized boolean Closes #333 See merge request cmucl/cmucl!231 - - - - - 3 changed files: - src/code/load.lisp - src/compiler/fndb.lisp - tests/issues.lisp Changes: ===================================== src/code/load.lisp ===================================== @@ -565,7 +565,8 @@ (fasload filename) (sloload filename)) (let ((pn (merge-pathnames (pathname filename) - *default-pathname-defaults* nil))) + *default-pathname-defaults* nil)) + (if-does-not-exist (if if-does-not-exist :error nil))) (if (wild-pathname-p pn) (dolist (file (directory pn) t) (internal-load pn file if-does-not-exist contents ===================================== src/compiler/fndb.lisp ===================================== @@ -1119,7 +1119,7 @@ (defknown load ((or filename stream) - &key (:verbose t) (:print t) (:if-does-not-exist (member :error nil)) + &key (:verbose t) (:print t) (:if-does-not-exist t) (:if-source-newer (member :load-source :load-object :query :compile)) (:contents (or null (member :source :binary))) (:external-format t)) ===================================== tests/issues.lisp ===================================== @@ -1105,3 +1105,16 @@ (not (zerop n)))) (dolist (x '(0 1 1000)) (assert-equal (expected x) (fun x) x)))) + +(define-test issue.333.if-does-not-exist + (:tag :issues) + ;; "unknown.lisp" should be a file that doesn't exist. Verify that + ;; if :IF-DOES-NOT-EXIST is non-NIL we signal an error from LOAD. + ;; The first case is the old default value of :ERROR. + (assert-error 'file-error + (load "unknown.lisp" :if-does-not-exist :error)) + ;; :IF-DOES-NOT-EXIST is a generalized BOOLEAN, so non-NIL will + ;; signal an error too. + (assert-error 'file-error + (load "unknown.lisp" :if-does-not-exist t)) + (assert-false (load "unknown.lisp" :if-does-not-exist nil))) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/bf1475ce65e21ef3dd6fc1e... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/bf1475ce65e21ef3dd6fc1e... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)