diff options
| author | Przemysław Kryger | 2025-12-09 09:20:44 +0000 |
|---|---|---|
| committer | Michael Albinus | 2025-12-09 16:10:20 +0100 |
| commit | 244dc6f15e333918db67f15f6b83d9508d0779e2 (patch) | |
| tree | a1ab5b5ba1df48799f7f823c41675b3587fb4869 /test | |
| parent | 5731343ffe655cd3dc8f78bba1ece454304d7fe7 (diff) | |
| download | emacs-244dc6f15e333918db67f15f6b83d9508d0779e2.tar.gz emacs-244dc6f15e333918db67f15f6b83d9508d0779e2.zip | |
Update email and rename packages and buffers in package-vc-tests
* test/lisp/emacs-lisp/package-vc-tests.el
(package-vc-tests-packages): Rename test packages to avoid
suffix being treated as a version number by
`package--description-file'.
(package-vc-tests-add): Ensure suffix capitalisation remains as
original when calling `replace-regexp-in-string'.
(package-vc-tests-create-repository): Fix typo in temporary
email and use a reserved TLD.
(package-vc-tests-environment-tear-down): Rename preserved
buffers to avoid conflicts between tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/package-vc-tests.el | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/test/lisp/emacs-lisp/package-vc-tests.el b/test/lisp/emacs-lisp/package-vc-tests.el index 6430848b094..c06dce71e03 100644 --- a/test/lisp/emacs-lisp/package-vc-tests.el +++ b/test/lisp/emacs-lisp/package-vc-tests.el | |||
| @@ -94,47 +94,47 @@ the package. Otherwise each entry is in a form of PKG." | |||
| 94 | (list | 94 | (list |
| 95 | ;; checkout and install with `package-vc-install' (on ELPA) | 95 | ;; checkout and install with `package-vc-install' (on ELPA) |
| 96 | (test-package-def | 96 | (test-package-def |
| 97 | test-package-1 package-user-dir nil | 97 | test-package-one package-user-dir nil |
| 98 | package-vc-tests-install-from-elpa) | 98 | package-vc-tests-install-from-elpa) |
| 99 | ;; checkout and install with `package-vc-install' (not on ELPA) | 99 | ;; checkout and install with `package-vc-install' (not on ELPA) |
| 100 | (test-package-def | 100 | (test-package-def |
| 101 | test-package-2 package-user-dir nil | 101 | test-package-two package-user-dir nil |
| 102 | package-vc-tests-install-from-spec) | 102 | package-vc-tests-install-from-spec) |
| 103 | ;; checkout with `package-vc-checktout' and install with | 103 | ;; checkout with `package-vc-checktout' and install with |
| 104 | ;; `package-vc-install-from-checkout' (on ELPA) | 104 | ;; `package-vc-install-from-checkout' (on ELPA) |
| 105 | (test-package-def | 105 | (test-package-def |
| 106 | test-package-3 package-vc-tests-dir nil | 106 | test-package-three package-vc-tests-dir nil |
| 107 | package-vc-tests-checkout-from-elpa-install-from-checkout) | 107 | package-vc-tests-checkout-from-elpa-install-from-checkout) |
| 108 | ;; checkout with git and install with | 108 | ;; checkout with git and install with |
| 109 | ;; `package-vc-install-from-checkout' | 109 | ;; `package-vc-install-from-checkout' |
| 110 | (test-package-def | 110 | (test-package-def |
| 111 | test-package-4 package-vc-tests-dir nil | 111 | test-package-four package-vc-tests-dir nil |
| 112 | package-vc-tests-checkout-with-git-install-from-checkout) | 112 | package-vc-tests-checkout-with-git-install-from-checkout) |
| 113 | ;; sources in "lisp" sub directory, checkout and install with | 113 | ;; sources in "lisp" sub directory, checkout and install with |
| 114 | ;; `package-vc-install' (not on ELPA) | 114 | ;; `package-vc-install' (not on ELPA) |
| 115 | (test-package-def | 115 | (test-package-def |
| 116 | test-package-5 package-user-dir "lisp" | 116 | test-package-five package-user-dir "lisp" |
| 117 | package-vc-tests-install-from-spec) | 117 | package-vc-tests-install-from-spec) |
| 118 | ;; sources in "lisp" sub directory, checkout with git and | 118 | ;; sources in "lisp" sub directory, checkout with git and |
| 119 | ;; install with `package-vc-install-from-checkout' | 119 | ;; install with `package-vc-install-from-checkout' |
| 120 | (test-package-def | 120 | (test-package-def |
| 121 | test-package-6 package-vc-tests-dir "lisp" | 121 | test-package-six package-vc-tests-dir "lisp" |
| 122 | package-vc-tests-checkout-with-git-install-from-checkout) | 122 | package-vc-tests-checkout-with-git-install-from-checkout) |
| 123 | ;; sources in "src" sub directory, checkout and install with | 123 | ;; sources in "src" sub directory, checkout and install with |
| 124 | ;; `package-vc-install' (on ELPA) | 124 | ;; `package-vc-install' (on ELPA) |
| 125 | (test-package-def | 125 | (test-package-def |
| 126 | test-package-7 package-user-dir "src" | 126 | test-package-seven package-user-dir "src" |
| 127 | package-vc-tests-install-from-elpa) | 127 | package-vc-tests-install-from-elpa) |
| 128 | ;; sources in "src" sub directory, checkout with | 128 | ;; sources in "src" sub directory, checkout with |
| 129 | ;; `package-vc-checktout' and install with | 129 | ;; `package-vc-checktout' and install with |
| 130 | ;; `package-vc-install-from-checkout' (on ELPA) | 130 | ;; `package-vc-install-from-checkout' (on ELPA) |
| 131 | (test-package-def | 131 | (test-package-def |
| 132 | test-package-8 package-vc-tests-dir nil | 132 | test-package-eight package-vc-tests-dir nil |
| 133 | package-vc-tests-checkout-from-elpa-install-from-checkout) | 133 | package-vc-tests-checkout-from-elpa-install-from-checkout) |
| 134 | ;; sources in "custom-dir" sub directory, checkout and install | 134 | ;; sources in "custom-dir" sub directory, checkout and install |
| 135 | ;; with `package-vc-install' (on ELPA) | 135 | ;; with `package-vc-install' (on ELPA) |
| 136 | (test-package-def | 136 | (test-package-def |
| 137 | test-package-9 package-user-dir "custom-dir" | 137 | test-package-nine package-user-dir "custom-dir" |
| 138 | package-vc-tests-install-from-elpa)))))) | 138 | package-vc-tests-install-from-elpa)))))) |
| 139 | 139 | ||
| 140 | ;; TODO: add test for deleting packages, with asserting | 140 | ;; TODO: add test for deleting packages, with asserting |
| @@ -155,7 +155,8 @@ When LISP-DIR is non-nil place the NAME file under LISP-DIR." | |||
| 155 | (: ".in" string-end)) ) | 155 | (: ".in" string-end)) ) |
| 156 | (lambda (mat) | 156 | (lambda (mat) |
| 157 | (if (string= mat "SUFFIX") suffix "")) | 157 | (if (string= mat "SUFFIX") suffix "")) |
| 158 | in-file))) | 158 | in-file |
| 159 | :fixedcase))) | ||
| 159 | (file-name-concat lisp-dir file)))) | 160 | (file-name-concat lisp-dir file)))) |
| 160 | (unless (zerop (call-process | 161 | (unless (zerop (call-process |
| 161 | "sed" (expand-file-name in-file resource-dir) | 162 | "sed" (expand-file-name in-file resource-dir) |
| @@ -171,7 +172,13 @@ If LISP-DIR is non-nil place sources of the package in LISP-DIR." | |||
| 171 | (repo-dir (expand-file-name (file-name-concat "repo" name) | 172 | (repo-dir (expand-file-name (file-name-concat "repo" name) |
| 172 | package-vc-tests-dir))) | 173 | package-vc-tests-dir))) |
| 173 | (make-directory (expand-file-name (or lisp-dir ".") repo-dir) t) | 174 | (make-directory (expand-file-name (or lisp-dir ".") repo-dir) t) |
| 174 | (let ((default-directory repo-dir)) | 175 | (let ((default-directory repo-dir) |
| 176 | (process-environment | ||
| 177 | (append (list | ||
| 178 | (format "EMAIL=%s@example.com" name) | ||
| 179 | (format "GIT_AUTHOR_NAME=%s" name) | ||
| 180 | (format "GIT_COMMITTER_NAME=%s" name)) | ||
| 181 | process-environment))) | ||
| 175 | (vc-git-command nil 0 nil "init" "-b" "master") | 182 | (vc-git-command nil 0 nil "init" "-b" "master") |
| 176 | (package-vc-tests-add | 183 | (package-vc-tests-add |
| 177 | suffix "test-package-SUFFIX-lib-v0.1.el.in" lisp-dir) | 184 | suffix "test-package-SUFFIX-lib-v0.1.el.in" lisp-dir) |
| @@ -530,10 +537,20 @@ when PKG matches `package-vc-tests-preserve-artefacts'." | |||
| 530 | (if (or (memq package-vc-tests-preserve-artefacts `(t ,pkg)) | 537 | (if (or (memq package-vc-tests-preserve-artefacts `(t ,pkg)) |
| 531 | (and (listp package-vc-tests-preserve-artefacts) | 538 | (and (listp package-vc-tests-preserve-artefacts) |
| 532 | (memq pkg package-vc-tests-preserve-artefacts))) | 539 | (memq pkg package-vc-tests-preserve-artefacts))) |
| 533 | (message | 540 | (let ((buffers |
| 534 | "package-vc-tests: preserving temporary directory: %s%s" | 541 | (mapconcat (lambda (buffer) |
| 535 | package-vc-tests-dir | 542 | (with-current-buffer buffer |
| 536 | (and buffers (format " and buffers: %s" buffers))) | 543 | (let* ((old-name (buffer-name)) |
| 544 | (new-name (make-temp-name | ||
| 545 | (string-trim old-name)))) | ||
| 546 | (rename-buffer new-name) | ||
| 547 | (concat old-name " -> " new-name)))) | ||
| 548 | buffers | ||
| 549 | ", "))) | ||
| 550 | (message | ||
| 551 | "package-vc-tests: preserving temporary directory: %s%s" | ||
| 552 | package-vc-tests-dir | ||
| 553 | (and buffers (format " and buffers: %s" buffers)))) | ||
| 537 | (delete-directory package-vc-tests-dir t) | 554 | (delete-directory package-vc-tests-dir t) |
| 538 | (dolist (buffer buffers) | 555 | (dolist (buffer buffers) |
| 539 | (kill-buffer buffer))))) | 556 | (kill-buffer buffer))))) |