diff options
| author | Artur Malabarba | 2015-12-03 15:24:51 +0000 |
|---|---|---|
| committer | Artur Malabarba | 2015-12-03 16:13:57 +0000 |
| commit | 50dce3c4225384cc3705bee4f8e55939f0885f73 (patch) | |
| tree | d8cc4053a89e803b3ff6e6b8f0694abb019c1f06 /test | |
| parent | 67c6906a5f2e79ef771a1d7c8abeb29eb633c659 (diff) | |
| download | emacs-50dce3c4225384cc3705bee4f8e55939f0885f73.tar.gz emacs-50dce3c4225384cc3705bee4f8e55939f0885f73.zip | |
* lisp/emacs-lisp/package.el (package-unpack): Load before compiling
Reload any previously loaded package files before compiling
the package (also reload the same files after compiling).
This ensures that we have the most recent definitions during
compilation, and avoids generating bad elc files when a macro
changes and it is used in a different file from the one it's
defined in.
Diffstat (limited to 'test')
5 files changed, 169 insertions, 0 deletions
diff --git a/test/automated/data/package/macro-problem-package-1.0/macro-aux.el b/test/automated/data/package/macro-problem-package-1.0/macro-aux.el new file mode 100644 index 00000000000..9d14a211639 --- /dev/null +++ b/test/automated/data/package/macro-problem-package-1.0/macro-aux.el | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | ;;; macro-aux.el --- laksd -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2015 Artur Malabarba | ||
| 4 | |||
| 5 | ;; Author: Artur Malabarba <emacs@endlessparentheses.com> | ||
| 6 | |||
| 7 | ;; This program is free software; you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; This program is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Commentary: | ||
| 21 | |||
| 22 | ;; | ||
| 23 | |||
| 24 | ;;; Code: | ||
| 25 | |||
| 26 | (defun macro-aux-1 ( &rest forms) | ||
| 27 | "Description" | ||
| 28 | `(progn ,@forms)) | ||
| 29 | |||
| 30 | (provide 'macro-aux) | ||
| 31 | ;;; macro-aux.el ends here | ||
diff --git a/test/automated/data/package/macro-problem-package-1.0/macro-problem.el b/test/automated/data/package/macro-problem-package-1.0/macro-problem.el new file mode 100644 index 00000000000..a44074c4f87 --- /dev/null +++ b/test/automated/data/package/macro-problem-package-1.0/macro-problem.el | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | ;;; macro-problem.el --- laksd -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2015 Artur Malabarba | ||
| 4 | |||
| 5 | ;; Author: Artur Malabarba <emacs@endlessparentheses.com> | ||
| 6 | ;; Keywords: tools | ||
| 7 | ;; Version: 1.0 | ||
| 8 | |||
| 9 | ;; This program is free software; you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; This program is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;; | ||
| 25 | |||
| 26 | ;;; Code: | ||
| 27 | |||
| 28 | (require 'macro-aux) | ||
| 29 | |||
| 30 | (defmacro macro-problem-1 ( &rest forms) | ||
| 31 | "Description" | ||
| 32 | `(progn ,@forms)) | ||
| 33 | |||
| 34 | (defun macro-problem-func () | ||
| 35 | "" | ||
| 36 | (macro-problem-1 'a 'b) | ||
| 37 | (macro-aux-1 'a 'b)) | ||
| 38 | |||
| 39 | (provide 'macro-problem) | ||
| 40 | ;;; macro-problem.el ends here | ||
diff --git a/test/automated/data/package/macro-problem-package-2.0/macro-aux.el b/test/automated/data/package/macro-problem-package-2.0/macro-aux.el new file mode 100644 index 00000000000..4785cd78031 --- /dev/null +++ b/test/automated/data/package/macro-problem-package-2.0/macro-aux.el | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | ;;; macro-aux.el --- laksd -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2015 Artur Malabarba | ||
| 4 | |||
| 5 | ;; Author: Artur Malabarba <emacs@endlessparentheses.com> | ||
| 6 | |||
| 7 | ;; This program is free software; you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; This program is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Commentary: | ||
| 21 | |||
| 22 | ;; | ||
| 23 | |||
| 24 | ;;; Code: | ||
| 25 | |||
| 26 | (defmacro macro-aux-1 ( &rest forms) | ||
| 27 | "Description" | ||
| 28 | `(progn ,@forms)) | ||
| 29 | |||
| 30 | (defmacro macro-aux-3 ( &rest _) | ||
| 31 | "Description" | ||
| 32 | 90) | ||
| 33 | |||
| 34 | (provide 'macro-aux) | ||
| 35 | ;;; macro-aux.el ends here | ||
diff --git a/test/automated/data/package/macro-problem-package-2.0/macro-problem.el b/test/automated/data/package/macro-problem-package-2.0/macro-problem.el new file mode 100644 index 00000000000..ead3d29dc3d --- /dev/null +++ b/test/automated/data/package/macro-problem-package-2.0/macro-problem.el | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | ;;; macro-problem.el --- laksd -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2015 Artur Malabarba | ||
| 4 | |||
| 5 | ;; Author: Artur Malabarba <emacs@endlessparentheses.com> | ||
| 6 | ;; Keywords: tools | ||
| 7 | ;; Version: 2.0 | ||
| 8 | |||
| 9 | ;; This program is free software; you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; This program is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;; | ||
| 25 | |||
| 26 | ;;; Code: | ||
| 27 | |||
| 28 | (require 'macro-aux) | ||
| 29 | |||
| 30 | (defmacro macro-problem-1 ( &rest forms) | ||
| 31 | "Description" | ||
| 32 | `(progn ,(cadr (car forms)))) | ||
| 33 | |||
| 34 | |||
| 35 | (defun macro-problem-func () | ||
| 36 | "" | ||
| 37 | (list (macro-problem-1 '1 'b) | ||
| 38 | (macro-aux-1 'a 'b))) | ||
| 39 | |||
| 40 | (defmacro macro-problem-3 (&rest _) | ||
| 41 | "Description" | ||
| 42 | 10) | ||
| 43 | |||
| 44 | (defun macro-problem-10-and-90 () | ||
| 45 | "" | ||
| 46 | (list (macro-problem-3 haha) (macro-aux-3 hehe))) | ||
| 47 | |||
| 48 | (provide 'macro-problem) | ||
| 49 | ;;; macro-problem.el ends here | ||
diff --git a/test/automated/package-test.el b/test/automated/package-test.el index de41c3bc8e4..8401d1879ae 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el | |||
| @@ -242,6 +242,20 @@ Must called from within a `tar-mode' buffer." | |||
| 242 | (should (package-installed-p 'simple-single)) | 242 | (should (package-installed-p 'simple-single)) |
| 243 | (should (package-installed-p 'simple-depend)))) | 243 | (should (package-installed-p 'simple-depend)))) |
| 244 | 244 | ||
| 245 | (ert-deftest package-test-macro-compilation () | ||
| 246 | "Install a package which includes a dependency." | ||
| 247 | (with-package-test (:basedir "data/package") | ||
| 248 | (package-install-file (expand-file-name "macro-problem-package-1.0/")) | ||
| 249 | (require 'macro-problem) | ||
| 250 | ;; `macro-problem-func' uses a macro from `macro-aux'. | ||
| 251 | (should (equal (macro-problem-func) '(progn a b))) | ||
| 252 | (package-install-file (expand-file-name "macro-problem-package-2.0/")) | ||
| 253 | ;; After upgrading, `macro-problem-func' depends on a new version | ||
| 254 | ;; of the macro from `macro-aux'. | ||
| 255 | (should (equal (macro-problem-func) '(1 b))) | ||
| 256 | ;; `macro-problem-10-and-90' depends on an entirely new macro from `macro-aux'. | ||
| 257 | (should (equal (macro-problem-10-and-90) '(10 90))))) | ||
| 258 | |||
| 245 | (ert-deftest package-test-install-two-dependencies () | 259 | (ert-deftest package-test-install-two-dependencies () |
| 246 | "Install a package which includes a dependency." | 260 | "Install a package which includes a dependency." |
| 247 | (with-package-test () | 261 | (with-package-test () |