1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

New tests for nested archives (bug#70987)

* test/lisp/tar-mode-tests.el (tar-mode-test-tar-extract-zip-and-gz):
* test/lisp/arc-mode-tests.el (arc-mode-test-zip-extract-tar-and-gz):
New tests.
* test/data/decompress/tzg.tar.gz:
* test/data/decompress/ztg.zip:
New data files to test decompressing of different combinations
of nested tar and zip archives.
This commit is contained in:
Juri Linkov 2024-05-20 09:22:10 +03:00
parent 44d1687f1f
commit 91e02dde5f
4 changed files with 30 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -46,6 +46,22 @@
(when (buffer-live-p zip-buffer) (kill-buffer zip-buffer))
(when (buffer-live-p gz-buffer) (kill-buffer gz-buffer)))))
(declare-function tar-extract "tar-mode")
(ert-deftest arc-mode-test-zip-extract-tar-and-gz ()
(skip-unless (and archive-zip-extract (executable-find (car archive-zip-extract))))
(skip-unless (executable-find "gzip"))
(require 'tar-mode)
(let* ((zip-file (expand-file-name "ztg.zip" arc-mode-tests-data-directory))
zip-buffer tar-buffer gz-buffer)
(unwind-protect
(with-current-buffer (setq zip-buffer (find-file-noselect zip-file))
(with-current-buffer (setq tar-buffer (archive-extract))
(setq gz-buffer (tar-extract))
(should (equal (char-after) ?\N{SNOWFLAKE}))))
(when (buffer-live-p zip-buffer) (kill-buffer zip-buffer))
(when (buffer-live-p tar-buffer) (kill-buffer tar-buffer))
(when (buffer-live-p gz-buffer) (kill-buffer gz-buffer)))))
(ert-deftest arc-mode-test-zip-ensure-ext ()
"Regression test for bug#61326."
(skip-unless (executable-find "zip"))

View File

@ -46,6 +46,20 @@
(when (buffer-live-p tar-buffer) (kill-buffer tar-buffer))
(when (buffer-live-p gz-buffer) (kill-buffer gz-buffer)))))
(ert-deftest tar-mode-test-tar-extract-zip-and-gz ()
(skip-unless (executable-find "gzip"))
(require 'arc-mode)
(let* ((tar-file (expand-file-name "tzg.tar.gz" tar-mode-tests-data-directory))
tar-buffer zip-buffer gz-buffer)
(unwind-protect
(with-current-buffer (setq tar-buffer (find-file-noselect tar-file))
(with-current-buffer (setq zip-buffer (tar-extract))
(setq gz-buffer (archive-extract))
(should (equal (char-after) ?\N{SNOWFLAKE}))))
(when (buffer-live-p tar-buffer) (kill-buffer tar-buffer))
(when (buffer-live-p zip-buffer) (kill-buffer zip-buffer))
(when (buffer-live-p gz-buffer) (kill-buffer gz-buffer)))))
(provide 'tar-mode-tests)
;;; tar-mode-tests.el ends here