summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/package-tests.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-10-08 12:19:40 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2022-10-08 12:19:40 -0400
commit8de7995ae6388e5ae5418cb6af579281121f14a4 (patch)
tree4371ff552e436b835824caf09d321c9ef585d7e8 /test/lisp/emacs-lisp/package-tests.el
parentb8ab4f018bd541caf8d7b71e0b1bd6f81f2d3bbb (diff)
downloademacs-8de7995ae6388e5ae5418cb6af579281121f14a4.tar.gz
emacs-8de7995ae6388e5ae5418cb6af579281121f14a4.tar.bz2
emacs-8de7995ae6388e5ae5418cb6af579281121f14a4.zip
package.el: Understand a few more variations in tarball formats
* lisp/emacs-lisp/package.el (package-untar-buffer): Fix thinko. (package-tar-file-info): Handle the case where the first file is in a subdirectory. * test/lisp/emacs-lisp/package-tests.el (package-test-bug58367): New test. * test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar: * test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar: New files.
Diffstat (limited to 'test/lisp/emacs-lisp/package-tests.el')
-rw-r--r--test/lisp/emacs-lisp/package-tests.el24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
index b903cd781ba..ffe4d7cd5fd 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -275,11 +275,31 @@ Must called from within a `tar-mode' buffer."
(let* ((pkg-el "multi-file-0.2.3.tar")
(source-file (expand-file-name pkg-el (ert-resource-directory))))
- (package-initialize)
(should-not (package-installed-p 'multie-file))
(package-install-file source-file)
(should (package-installed-p 'multi-file))
- (package-delete (cadr (assq 'multi-file package-alist))))
+ (package-delete (cadr (assq 'multi-file package-alist))))))
+
+(ert-deftest package-test-bug58367 ()
+ "Check variations in tarball formats."
+ (with-package-test (:basedir (ert-resource-directory))
+ (package-initialize)
+
+ ;; A package whose first entry is the main dir but without trailing /.
+ (let* ((pkg-el "ustar-withsub-0.1.tar")
+ (source-file (expand-file-name pkg-el (ert-resource-directory))))
+ (should-not (package-installed-p 'ustar-withsub))
+ (package-install-file source-file)
+ (should (package-installed-p 'ustar-withsub))
+ (package-delete (cadr (assq 'ustar-withsub package-alist))))
+
+ ;; A package whose first entry is a file in a subdir.
+ (let* ((pkg-el "v7-withsub-0.1.tar")
+ (source-file (expand-file-name pkg-el (ert-resource-directory))))
+ (should-not (package-installed-p 'v7-withsub))
+ (package-install-file source-file)
+ (should (package-installed-p 'v7-withsub))
+ (package-delete (cadr (assq 'v7-withsub package-alist))))
))
(ert-deftest package-test-install-file-EOLs ()