Skip to content

Commit

Permalink
Handle the package name conflict between cl-json (package :json) and …
Browse files Browse the repository at this point in the history
…yason (package :yason with nickname :json)
  • Loading branch information
avodonosov committed Mar 18, 2012
1 parent 2c38acb commit 636123d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test-grid.lisp
Expand Up @@ -551,15 +551,34 @@ just passed to the QUICKLISP:QUICKLOAD."

(defmethod libtest ((library-name (eql :yason)))
;; test framework used: unit-test

;; Handle package name conflict between cl-json
;; and yason: the package of cl-json is named :json,
;; the package of yason is named :yason, but has
;; :json as a nickname.

;; Temporary rename the :json package if it's loaded
(when (and (find-package :json)
;; make sure it's found not by a nickname
(string= :json (package-name :json)))
(rename-package :json :json-temp-uinuque-name))

(quicklisp:quickload :yason)
;; it doesn't provide ASDF system for tests,
;; it doesn't provide an ASDF system for tests,
;; load the test framework manually, and then
;; the test.lisp file.
(quicklisp:quickload :unit-test)
(let* ((yason-dir (make-pathname :name nil :type nil :defaults (ql-dist:find-asdf-system-file "yason")))
(yason-test-file (merge-pathnames "test.lisp" yason-dir)))
(format t "loading ~A~%" yason-test-file)
(load yason-test-file))

;; remove nicknames from the :yason package
(rename-package :yason :yason nil)
;; rename :json back to it's original name
(when (find-package :json-temp-uinuque-name)
(rename-package :json-temp-uinuque-name :json))

;; nor run the tests. It returns a boolean
(funcall (read-from-string "unit-test:run-all-tests") :unit :yason))

Expand Down

0 comments on commit 636123d

Please sign in to comment.