default method for test-system?

Faré fahree at gmail.com
Sun Apr 26 03:20:48 UTC 2015


>>> what about this default method (or something similar) for test-op?
>>>
>>> (defmethod perform ((o test-op) (s system))
>>>   (loop :with name = (coerce-name s)
>>>         :for suffix :in '("" "/test" "-test")
>>>         :for test-system-name = (strcat name suffix)
>>>         :for test-system = (find-system test-system-name nil)
>>>         :when test-system :do
>>>           (load-system test-system)
>>>           ;; Would be string-upcase, if not to accommodate for "modern" syntax.
>>>           ;; UIOP probably needs to offer a standard way to abstract over
>>>           ;; the string-upcase vs string-downcase vs neither default.
>>>           (flet ((symbol-namify (x) (string (safe-read-from-string x))))
>>>             (if-let (test-suite (find-symbol* '#:test-suite
>>> (symbol-namify test-system-name) nil))
>>>               (return (funcall test-suite))))
>>>         :finally (error "No tests found for system ~A" name)))
>>>
The plan for such a default method isn't fully baked enough, but
I added these two functions to uiop/utility that I believe are useful to have
in the above case and other similar cases (I'm can think of places where I've
used STRING-UPCASE when scripting in CL, where I could use them instead):

  (defun standard-case-symbol-name (name-designator)
    "Given a NAME-DESIGNATOR for a symbol, convert it to a string,
using STRING-UPCASE on an ANSI CL
platform, or STRING on a so-called \"modern\" platform such as Allegro
with modern syntax."
    (cond
      ;; Should we be doing something on CLISP?
      #+allegro ((eq excl:*current-case-mode* :case-sensitive-lower)
(string name-designator))
      (t (string-upcase name-designator))))

  (defun find-standard-case-symbol (name-designator package-designator
&optional (error t))
    "Find a symbol in a package the name of which is designated by
NAME-DESIGNATOR;
NAME-DESIGNATOR and PACKAGE-DESIGNATOR will be converted to a string
using STRING-DESIGNATOR on an
ANSI CL platform, or STRING on a so-called \"modern\" platform such as
Allegro with modern syntax.
If optional ERROR argument is NIL, return NIL instead of an error when
the symbol is not found."
    (find-symbol* (standard-case-symbol-name name-designator)
                  (etypecase package-designator
                    ((or package null) package-designator)
                    ((or string symbol)))
                  error))

It's still time to change and/or rename these functions before next release.

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Syllables: first five
seven next, and five at last
Cut! A season. Done.



More information about the asdf-devel mailing list