Commit 239901d1 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

2.32.34: fix base-string-p. Add tests for it.

parent ad704c3e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@
  :licence "MIT"
  :description "Another System Definition Facility"
  :long-description "ASDF builds Common Lisp software organized into defined systems."
  :version "2.32.23" ;; to be automatically updated by make bump-version
  :version "2.32.24" ;; to be automatically updated by make bump-version
  :depends-on ()
  #+asdf3 :encoding #+asdf3 :utf-8
  ;; For most purposes, asdf itself specially counts as a builtin system.
+1 −1
Original line number Diff line number Diff line
;;; -*- mode: Common-Lisp; Base: 10 ; Syntax: ANSI-Common-Lisp -*-
;;; This is ASDF 2.32.23: Another System Definition Facility.
;;; This is ASDF 2.32.24: Another System Definition Facility.
;;;
;;; Feedback, bug reports, and patches are all welcome:
;;; please mail to <asdf-devel@common-lisp.net>.
+23 −0
Original line number Diff line number Diff line
@@ -197,3 +197,26 @@
(assert (not (directory-exists-p (subpathname *build-directory* "deleteme/a/b/d/"))))
(assert (not (probe-file* (subpathname *build-directory* "deleteme/a/1.x"))))
(assert (not (probe-file* (subpathname *build-directory* "deleteme/a/b/2"))))

#+(and sbcl sb-unicode) (assert +non-base-chars-exist-p+)
#+(or clozure (and sbcl (not sb-unicode))) (assert (not +non-base-chars-exist-p+))

(assert (base-string-p (make-string 10 :element-type 'base-char)))
(assert-equal "abcd" (strcat "a" NIL "bc" "d"))
(assert-equal "abcd" (reduce/strcat '("a" NIL "bc" "d")))

#-non-base-chars-exist-p
(progn
  (assert (base-string-p (make-string 10 :element-type 'character))))

(defun basify (s) (coerce s 'base-string))

#+non-base-chars-exist-p
(progn
  (assert (not (base-string-p (make-string 10 :element-type 'character))))
  (assert (not (base-string-p "abc")))
  (assert (base-string-p (basify "abc")))
  (assert (not (base-string-p (strcat "a" NIL "b" "cd"))))
  (assert (base-string-p (reduce/strcat (mapcar 'basify '("a" "b" NIL "cd")))))
  (assert (base-string-p (strcat (basify "ab") (basify "cd"))))
  (assert (not (base-string-p (strcat (basify "ab") "cd")))))
+7 −6
Original line number Diff line number Diff line
@@ -187,21 +187,22 @@ Returns two values: \(A B C\) and \(1 2 3\)."

;;; Characters
(with-upgradability ()
  (defconstant +non-base-chars-exist-p+ (not (subtypep 'character 'base-char))))
  (defconstant +non-base-chars-exist-p+ (not (subtypep 'character 'base-char)))
  (when +non-base-chars-exist-p+ (pushnew :non-base-chars-exist-p *features*)))


;;; Strings
(with-upgradability ()
  (defun base-string-p (string)
    (declare (ignorable string))
    #.(or +non-base-chars-exist-p+ '(eq 'base-char (array-element-type string))))
    (and #+non-base-chars-exist-p (eq 'base-char (array-element-type string))))

  (defun strings-common-element-type (strings)
    (declare (ignorable strings))
    #.(if +non-base-chars-exist-p+
          '(if (loop :for s :in strings :always (or (null s) (base-string-p s)))
            'base-char 'character)
          ''character))
    #-non-base-chars-exist-p 'character
    #+non-base-chars-exist-p
    (if (loop :for s :in strings :always (or (null s) (base-string-p s)))
        'base-char 'character))

  (defun reduce/strcat (strings &key key start end)
    "Reduce a list as if by STRCAT, accepting KEY START and END keywords like REDUCE"
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ You can compare this string with e.g.: (ASDF:VERSION-SATISFIES (ASDF:ASDF-VERSIO
         ;; "3.4.5.67" would be a development version in the official upstream of 3.4.5.
         ;; "3.4.5.0.8" would be your eighth local modification of official release 3.4.5
         ;; "3.4.5.67.8" would be your eighth local modification of development version 3.4.5.67
         (asdf-version "2.32.23")
         (asdf-version "2.32.24")
         (existing-version (asdf-version)))
    (setf *asdf-version* asdf-version)
    (when (and existing-version (not (equal asdf-version existing-version)))
Loading