diff options
| author | Stefan Monnier | 2019-05-16 17:16:36 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2019-05-16 17:16:36 -0400 |
| commit | 9ed0b55848ce8a3049fd82e42cd9ea274410d426 (patch) | |
| tree | 7a726eb9181b9e07e5752222faae1f22d8268241 | |
| parent | c89b0add51305e83c822c08f1026e7d1278eec74 (diff) | |
| download | emacs-9ed0b55848ce8a3049fd82e42cd9ea274410d426.tar.gz emacs-9ed0b55848ce8a3049fd82e42cd9ea274410d426.zip | |
* cl-macs-tests.el (cl-macs-test--symbol-macrolet): New test
| -rw-r--r-- | test/lisp/emacs-lisp/cl-macs-tests.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 989553bd7bd..09ce660a2fd 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el | |||
| @@ -513,4 +513,21 @@ collection clause." | |||
| 513 | (macroexpand '(cl-defstruct (hash-table (:predicate hash-table-p)))) | 513 | (macroexpand '(cl-defstruct (hash-table (:predicate hash-table-p)))) |
| 514 | :type 'wrong-type-argument)) | 514 | :type 'wrong-type-argument)) |
| 515 | 515 | ||
| 516 | (ert-deftest cl-macs-test--symbol-macrolet () | ||
| 517 | ;; A `setq' shouldn't be converted to a `setf' just because it occurs within | ||
| 518 | ;; a symbol-macrolet! | ||
| 519 | (should-error | ||
| 520 | ;; Use `eval' so the error is signaled when running the test rather than | ||
| 521 | ;; when macroexpanding it. | ||
| 522 | (eval '(let ((l (list 1))) (cl-symbol-macrolet ((x 1)) (setq (car l) 0))))) | ||
| 523 | ;; Make sure `gv-synthetic-place' isn't macro-expanded before `setf' gets to | ||
| 524 | ;; see its `gv-expander'. | ||
| 525 | (should (equal (let ((l '(0))) | ||
| 526 | (let ((cl (car l))) | ||
| 527 | (cl-symbol-macrolet | ||
| 528 | ((p (gv-synthetic-place cl (lambda (v) `(setcar l ,v))))) | ||
| 529 | (cl-incf p))) | ||
| 530 | l) | ||
| 531 | '(1)))) | ||
| 532 | |||
| 516 | ;;; cl-macs-tests.el ends here | 533 | ;;; cl-macs-tests.el ends here |