Skip to content
Snippets Groups Projects
Commit f50fa01a authored by pfdietz's avatar pfdietz
Browse files

Pathological case of an uninterned symbol imported into the keyword package. Hilarity ensues.

parent f21335fb
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,31 @@ ...@@ -13,6 +13,31 @@
(return (list s nil)))) (return (list s nil))))
t) t)
;; Check that symbols that are interned in the KEYWORD
;; package, but do not have KEYWORD as their home package,
;; are in fact keywords.
;;
;; This came up on the #lisp irc channel
(deftest keyword.4
(let ((name "SYMBOL-NAME-FOR-KEYWORD.4")
(kwp (find-package "KEYWORD")))
(let ((s (find-symbol name kwp)))
(when s (unintern s kwp))
;; Now, create a symbol with this name
;; and import it into the keyword package
(setq s (make-symbol name))
(import s kwp)
;; Check that it's a keyword
(values
(symbol-package s)
(equalt (multiple-value-list (find-symbol name kwp))
(list s :external))
(notnot (typep s 'keyword))
(if (boundp s) (eqlt s (symbol-value s)) :not-bound)
(notnot (constantp s)))))
nil t t t t)
;; Every keyword is external ;; Every keyword is external
(deftest keyword.2 (deftest keyword.2
(do-symbols (s "KEYWORD" t) (do-symbols (s "KEYWORD" t)
...@@ -26,7 +51,12 @@ ...@@ -26,7 +51,12 @@
;; Every keyword evaluates to itself ;; Every keyword evaluates to itself
(deftest keyword.3 (deftest keyword.3
(do-symbols (s "KEYWORD" t) (do-symbols (s "KEYWORD" t)
(unless (eqt s (eval s)) (cond
(return (list s (eval s))))) ((not (boundp s))
(return (list s "NOT-BOUND")))
((not (eqt s (eval s)))
(return (list s (eval s))))))
t) t)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment