diff options
| author | Po Lu | 2021-12-09 10:30:18 +0800 |
|---|---|---|
| committer | Po Lu | 2021-12-09 10:30:18 +0800 |
| commit | 47cd820d93d282da484ae91e68021736ed7994bc (patch) | |
| tree | a24229d1df8547dfd427ef97cf9968b7f5a1e7a8 /test | |
| parent | 41b1d223c6ab7bca1b626a4c07a4f2dda2855feb (diff) | |
| parent | 63f07ea22f3954c2154d831017caf494911cb515 (diff) | |
| download | emacs-47cd820d93d282da484ae91e68021736ed7994bc.tar.gz emacs-47cd820d93d282da484ae91e68021736ed7994bc.zip | |
Merge remote-tracking branch 'origin/master' into feature/pgtk
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/cl-macs-tests.el | 12 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/subr-x-tests.el | 20 |
2 files changed, 25 insertions, 7 deletions
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 7c3afefaadd..13da60ec45e 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el | |||
| @@ -668,13 +668,13 @@ collection clause." | |||
| 668 | #'len)) | 668 | #'len)) |
| 669 | (`(function (lambda (,_ ,_) . ,_)) t)))) | 669 | (`(function (lambda (,_ ,_) . ,_)) t)))) |
| 670 | 670 | ||
| 671 | (with-suppressed-warnings ((lexical test) (lexical test1) (lexical test2)) | ||
| 672 | (defvar test) | ||
| 673 | (defvar test1) | ||
| 674 | (defvar test2)) | ||
| 675 | (ert-deftest cl-macs--progv () | 671 | (ert-deftest cl-macs--progv () |
| 676 | (should (= (cl-progv '(test test) '(1 2) test) 2)) | 672 | (defvar cl-macs--test) |
| 677 | (should (equal (cl-progv '(test1 test2) '(1 2) (list test1 test2)) | 673 | (defvar cl-macs--test1) |
| 674 | (defvar cl-macs--test2) | ||
| 675 | (should (= (cl-progv '(cl-macs--test cl-macs--test) '(1 2) cl-macs--test) 2)) | ||
| 676 | (should (equal (cl-progv '(cl-macs--test1 cl-macs--test2) '(1 2) | ||
| 677 | (list cl-macs--test1 cl-macs--test2)) | ||
| 678 | '(1 2)))) | 678 | '(1 2)))) |
| 679 | 679 | ||
| 680 | ;;; cl-macs-tests.el ends here | 680 | ;;; cl-macs-tests.el ends here |
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index d8369506000..821b6770ba0 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el | |||
| @@ -676,7 +676,7 @@ | |||
| 676 | (buffer-string)) | 676 | (buffer-string)) |
| 677 | "foo\n"))) | 677 | "foo\n"))) |
| 678 | 678 | ||
| 679 | (ert-deftest test-add-display-text-property () | 679 | (ert-deftest subr-x-test-add-display-text-property () |
| 680 | (with-temp-buffer | 680 | (with-temp-buffer |
| 681 | (insert "Foo bar zot gazonk") | 681 | (insert "Foo bar zot gazonk") |
| 682 | (add-display-text-property 4 8 'height 2.0) | 682 | (add-display-text-property 4 8 'height 2.0) |
| @@ -694,5 +694,23 @@ | |||
| 694 | [(raise 0.5) (height 2.0)])) | 694 | [(raise 0.5) (height 2.0)])) |
| 695 | (should (equal (get-text-property 9 'display) '(raise 0.5))))) | 695 | (should (equal (get-text-property 9 'display) '(raise 0.5))))) |
| 696 | 696 | ||
| 697 | (ert-deftest subr-x-named-let () | ||
| 698 | (let ((funs ())) | ||
| 699 | (named-let loop | ||
| 700 | ((rest '(1 42 3)) | ||
| 701 | (sum 0)) | ||
| 702 | (when rest | ||
| 703 | ;; Here, we make sure that the variables are distinct in every | ||
| 704 | ;; iteration, since a naive tail-call optimization would tend to end up | ||
| 705 | ;; with a single `sum' variable being shared by all the closures. | ||
| 706 | (push (lambda () sum) funs) | ||
| 707 | ;; Here we add a dummy `sum' variable which shadows the `sum' iteration | ||
| 708 | ;; variable since a naive tail-call optimization could also trip here | ||
| 709 | ;; thinking it can `(setq sum ...)' to set the iteration | ||
| 710 | ;; variable's value. | ||
| 711 | (let ((sum sum)) | ||
| 712 | (loop (cdr rest) (+ sum (car rest)))))) | ||
| 713 | (should (equal (mapcar #'funcall funs) '(43 1 0))))) | ||
| 714 | |||
| 697 | (provide 'subr-x-tests) | 715 | (provide 'subr-x-tests) |
| 698 | ;;; subr-x-tests.el ends here | 716 | ;;; subr-x-tests.el ends here |