Skip to content

Commit

Permalink
Add some validation to report-properties
Browse files Browse the repository at this point in the history
In particular add a check that the :name report-property is
given only simple names and not directories.
  • Loading branch information
Gary King committed Mar 4, 2012
1 parent 62a7867 commit 4c8a11b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion dev/config.lisp
Expand Up @@ -53,6 +53,12 @@ In all cases, the report will go into
(defgeneric handle-config-preference (name args)
)

(defgeneric validate-report-property (name args))

(defmethod validate-report-property (name args)
(declare (ignore name args))
t)

(defvar *current-configuration-stream* nil)

(defvar *current-asdf-system-name* nil
Expand Down Expand Up @@ -252,7 +258,17 @@ use asdf:test-op or bind *current-asdf-system-name* yourself."))))))

(defmethod handle-config-preference ((name (eql :report-property))
args)
(setf (test-result-property *test-result* (first args)) (second args)))
(let ((name (form-keyword (first args))))
(validate-report-property name (second args))
(setf (test-result-property *test-result* name) (second args))))

(defmethod validate-report-property ((name (eql :name)) args)
;; report name
(assert (stringp args) nil
":name property must be given a string, was given ~s" args)
(assert (null (pathname-directory args)) nil
"The :name property must be a simple name (not a directory), use :full-pathname if
you need more control"))

(defconfig-variable :profiling-threshold *profiling-threshold*)

Expand Down

0 comments on commit 4c8a11b

Please sign in to comment.