summaryrefslogtreecommitdiff
path: root/test/src/emacs-module-tests.el
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2018-01-28 21:36:03 +0100
committerPhilipp Stephani <phst@google.com>2018-02-02 20:56:01 +0100
commit0443411f5ce2594a6ec092cd96b92d0b920372f5 (patch)
tree7790497b70f0719498fe17043c956b42339a83e8 /test/src/emacs-module-tests.el
parent75c663f834528c5431973bf8dc6386c327f9fe0f (diff)
downloademacs-0443411f5ce2594a6ec092cd96b92d0b920372f5.tar.gz
Properly integrate modules into the loading process (Bug#30164).
* src/lread.c (Fload): Don't defer to module-load immediately when encountering a module, but use the normal loading machinery to properly set up load-history, check for recursive loads, print messages, etc. * test/src/emacs-module-tests.el (module/load-history): New test. (module/describe-function-1): Adapt test. * etc/NEWS: Mention fixed behavior.
Diffstat (limited to 'test/src/emacs-module-tests.el')
-rw-r--r--test/src/emacs-module-tests.el19
1 files changed, 14 insertions, 5 deletions
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 052f5c2f12c..4751638968f 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -17,6 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
+(require 'cl-lib)
(require 'ert)
(require 'help-fns)
@@ -267,13 +268,21 @@ during garbage collection."
(with-temp-buffer
(let ((standard-output (current-buffer)))
(describe-function-1 #'mod-test-sum)
- (should (equal (buffer-substring-no-properties 1 (point-max))
- ;; FIXME: This should print the actual module
- ;; filename.
- "a module function in `src/emacs-module-tests.el'.
+ (should (equal
+ (buffer-substring-no-properties 1 (point-max))
+ (format "a module function in `data/emacs-module/mod-test%s'.
(mod-test-sum a b)
-Return A + B")))))
+Return A + B"
+ module-file-suffix))))))
+
+(ert-deftest module/load-history ()
+ "Check that Bug#30164 is fixed."
+ (load mod-test-file)
+ (cl-destructuring-bind (file &rest entries) (car load-history)
+ (should (equal (file-name-sans-extension file) mod-test-file))
+ (should (member '(provide . mod-test) entries))
+ (should (member '(defun . mod-test-sum) entries))))
;;; emacs-module-tests.el ends here