diff options
author | Noam Postavsky <npostavs@gmail.com> | 2017-04-23 22:21:42 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2017-05-19 18:16:15 -0400 |
commit | 267be4bdc28564a99f45da29e84eb98838117b50 (patch) | |
tree | 3816b74e945cb1a17a1f4c8ad5e25e4abb0e8206 /test/lisp/progmodes/elisp-mode-tests.el | |
parent | c1c8b67246c4314b302cca2ac43f13a0baba4c16 (diff) | |
download | emacs-267be4bdc28564a99f45da29e84eb98838117b50.tar.gz |
Refactor lisp eval result printing
* lisp/simple.el (eval-expression-print-format): Don't check
`standard-output' or `current-prefix-arg'.
(eval-expression-get-print-arguments): New function, centralizes
decision about how to print results of `eval-expression' and
`eval-last-sexp'.
(eval-expression):
* lisp/progmodes/elisp-mode.el (elisp--eval-last-sexp-print-value):
Use it.
Diffstat (limited to 'test/lisp/progmodes/elisp-mode-tests.el')
-rw-r--r-- | test/lisp/progmodes/elisp-mode-tests.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 93c428b2d2b..5edb590b1e5 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -114,6 +114,24 @@ (should (member "backup-buffer" comps)) (should-not (member "backup-inhibited" comps))))) +;;; eval-last-sexp + +(ert-deftest eval-last-sexp-print-format-sym () + (with-temp-buffer + (let ((current-prefix-arg '(4))) + (erase-buffer) (insert "t") + (call-interactively #'eval-last-sexp) + (should (equal (buffer-string) "tt"))))) + +(ert-deftest eval-last-sexp-print-format-sym-echo () + ;; We can only check the echo area when running interactive. + (skip-unless (not noninteractive)) + (with-temp-buffer + (let ((current-prefix-arg nil)) + (erase-buffer) (insert "t") (message nil) + (call-interactively #'eval-last-sexp) + (should (equal (current-message) "t"))))) + ;;; xref (defun xref-elisp-test-descr-to-target (xref) |