[Git][cmucl/cmucl][issue-193-nil-unspecific-equivalent] Treat NIL, :NEWEST, and :UNSPECIFIC as equivalent for :version

Raymond Toy (@rtoy) gitlab at common-lisp.net
Sun Apr 30 01:55:19 UTC 2023



Raymond Toy pushed to branch issue-193-nil-unspecific-equivalent at cmucl / cmucl


Commits:
c487a6cf by Raymond Toy at 2023-04-29T18:53:42-07:00
Treat NIL, :NEWEST, and :UNSPECIFIC as equivalent for :version

Add tests for this too.

- - - - -


2 changed files:

- src/code/pathname.lisp
- tests/issues.lisp


Changes:

=====================================
src/code/pathname.lisp
=====================================
@@ -505,11 +505,13 @@
 		  (eq that :unspecific)))))))
 
 ;; Compare the version component.  We treat NIL to be EQUAL to
-;; :NEWEST.
+;; :NEWEST or :UNSPECIFIC.
 (defun compare-version-component (this that)
   (or (eql this that)
-      (and (null this) (eq that :newest))
-      (and (null that) (eq this :newest))))
+      (if (and (member this '(nil :newest :unspecific) :test #'eq)
+	       (member that '(nil :newest :unspecific) :test #'eq))
+	  t
+	  nil)))
 
 ;;;; Pathname functions.
 


=====================================
tests/issues.lisp
=====================================
@@ -962,3 +962,18 @@
 		      (make-pathname :type nil)))
   (assert-true (equal (make-pathname :type nil)
 		      (make-pathname :type :unspecific))))
+
+(define-test issue.192.version
+  (assert-true (equal (make-pathname :version :newest)
+		      (make-pathname :version nil)))
+  (assert-true (equal (make-pathname :version nil)
+		      (make-pathname :version :newest)))
+  (assert-true (equal (make-pathname :version :unspecific)
+		      (make-pathname :version nil)))
+  (assert-true (equal (make-pathname :version nil)
+		      (make-pathname :version :unspecific)))
+  (assert-true (equal (make-pathname :version :unspecific)
+		      (make-pathname :version :newest)))
+  (assert-true (equal (make-pathname :version :newest)
+		      (make-pathname :version :unspecific)))
+)



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c487a6cf06ef73aaa361fe0878e4f375497a416c

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c487a6cf06ef73aaa361fe0878e4f375497a416c
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20230430/a5bae1f3/attachment-0001.html>


More information about the cmucl-cvs mailing list