]> git.eshelyaron.com Git - emacs.git/commitdiff
package-tests.el: Add test Bug#65475
authorPhilip Kaludercic <philipk@posteo.net>
Thu, 14 Sep 2023 13:09:19 +0000 (15:09 +0200)
committerPhilip Kaludercic <philipk@posteo.net>
Thu, 21 Sep 2023 16:28:30 +0000 (18:28 +0200)
* test/lisp/emacs-lisp/package-tests.el (with-package-test): Bind
package-selected-packages.
(package-test-bug65475): Add test.

test/lisp/emacs-lisp/package-tests.el

index 113b4ec12a8c2194810d08610125b64467aaa07b..e44ad3677d1e3307e5958fecd3689a7f8d211522 100644 (file)
             abbreviated-home-dir
             package--initialized
             package-alist
+            package-selected-packages
             ,@(if update-news
                   '(package-update-news-on-upload t)
                 (list (cl-gensym)))
@@ -307,6 +308,21 @@ Must called from within a `tar-mode' buffer."
       (package-delete (cadr (assq 'v7-withsub package-alist))))
     ))
 
+(ert-deftest package-test-bug65475 ()
+  "Deleting the last package clears `package-selected-packages'."
+  (with-package-test (:basedir (ert-resource-directory))
+    (package-initialize)
+    (let* ((pkg-el "simple-single-1.3.el")
+           (source-file (expand-file-name pkg-el (ert-resource-directory))))
+      (package-install-file source-file)
+      (should package-alist)
+      (should package-selected-packages)
+      (let ((desc (cadr (assq 'simple-single package-alist))))
+        (should desc)
+        (package-delete desc))
+      (should-not package-alist)
+      (should-not package-selected-packages))))
+
 (ert-deftest package-test-install-file-EOLs ()
   "Install same file multiple time with `package-install-file'
 but with a different end of line convention (bug#48137)."