}
if (EQ (found, Qunbound))
- pkg_error ("Symbol '%s' is not accessible in package '%s'",
- SDATA (name), SDATA (PACKAGE_NAMEX (package)));
+ {
+ if (external)
+ pkg_error ("Symbol '%s' is not accessible in package '%s'",
+ SDATA (name), SDATA (PACKAGE_NAMEX (package)));
+ /* Access with x::y. intern y into x. */
+ return pkg_intern_symbol (name, package, NULL);
+ }
/* Check if the symbol is accesible in the package as external
symbol. PKG-FIXME: Check what to do for inherited symbols. */
(should (eq (find-package "y") p)))
(delete-package p))))
+(ert-deftest pkg-tests-read ()
+ (with-packages ((x :register t))
+ (let* ((package-prefixes nil)
+ (sym (read "x::y")))
+ (should (symbolp sym))
+ (should (equal (symbol-name sym) "x::y"))
+ (should (eq (symbol-package sym) *emacs-package*))
+
+ (setq sym (read ":b"))
+ (should (keywordp sym))
+ (should (equal (cl-symbol-name sym) "b"))
+ (should (equal (symbol-name sym) ":b"))
+ (should (eq (symbol-package sym) *keyword-package*))))
+
+ (with-packages ((x :register t))
+ (let* ((package-prefixes t)
+ (sym (read "x::y")))
+ (should (symbolp sym))
+ (should (equal (symbol-name sym) "y"))
+ (should (eq (symbol-package sym) x))
+
+ (setq sym (read ":a"))
+ (should (keywordp sym))
+ (should (equal (cl-symbol-name sym) "a"))
+ (should (equal (symbol-name sym) ":a"))
+ (should (eq (symbol-package sym) *keyword-package*)))))
+
(ert-deftest pkg-tests-make-package-nicknames ()
;; Valid nicknames
(dolist (nickname '("a" b ?c))