aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGemini Lasswell2017-11-01 21:13:02 -0700
committerGemini Lasswell2017-11-26 13:44:15 -0800
commit0ded1b41a986229eaa4218095d9c78d1800c0b27 (patch)
treee7df79ca1383abc77d33d444e0998dacdfbce122 /test
parent16358d4fcbad3fa60ff36167ae666b1ec7e7c02a (diff)
downloademacs-0ded1b41a986229eaa4218095d9c78d1800c0b27.tar.gz
emacs-0ded1b41a986229eaa4218095d9c78d1800c0b27.zip
Fix Edebug's handling of dotted specs (bug#6415)
* lisp/emacs-lisp/cl-macs.el (cl-destructuring-bind): Use cl-macro-list1 instead of cl-macro-list in Edebug spec. * lisp/emacs-lisp/edebug.el (edebug-after-dotted-spec): Delete unused variable. (edebug-dotted-spec): Add docstring. (edebug-match-specs): Allow &optional and &rest specs to match nothing at the tail of a dotted form. Handle matches of dotted form tails which return non-lists. * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-dotted-forms): New test. * test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el: (edebug-test-code-use-destructuring-bind): New function.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el4
-rw-r--r--test/lisp/emacs-lisp/edebug-tests.el14
2 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
index f52a2b1896c..ca49dcd213d 100644
--- a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
+++ b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
@@ -126,5 +126,9 @@
126 !start!(with-current-buffer (get-buffer-create "*edebug-test-code-buffer*") 126 !start!(with-current-buffer (get-buffer-create "*edebug-test-code-buffer*")
127 !body!(format "current-buffer: %s" (current-buffer)))) 127 !body!(format "current-buffer: %s" (current-buffer))))
128 128
129(defun edebug-test-code-use-destructuring-bind ()
130 (let ((two 2) (three 3))
131 (cl-destructuring-bind (x . y) (cons two three) (+ x!x! y!y!))))
132
129(provide 'edebug-test-code) 133(provide 'edebug-test-code)
130;;; edebug-test-code.el ends here 134;;; edebug-test-code.el ends here
diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el
index 02f4d1c5abe..f6c016cdf80 100644
--- a/test/lisp/emacs-lisp/edebug-tests.el
+++ b/test/lisp/emacs-lisp/edebug-tests.el
@@ -899,5 +899,19 @@ test and possibly others should be updated."
899 "@g" (should (equal edebug-tests-@-result 899 "@g" (should (equal edebug-tests-@-result
900 '(#("abcd" 1 3 (face italic)) 511)))))) 900 '(#("abcd" 1 3 (face italic)) 511))))))
901 901
902(ert-deftest edebug-tests-dotted-forms ()
903 "Edebug can instrument code matching the tail of a dotted spec (Bug#6415)."
904 (edebug-tests-with-normal-env
905 (edebug-tests-setup-@ "use-destructuring-bind" nil t)
906 (edebug-tests-run-kbd-macro
907 "@ SPC SPC SPC SPC SPC SPC"
908 (edebug-tests-should-be-at "use-destructuring-bind" "x")
909 (edebug-tests-should-match-result-in-messages "2 (#o2, #x2, ?\\C-b)")
910 "SPC"
911 (edebug-tests-should-be-at "use-destructuring-bind" "y")
912 (edebug-tests-should-match-result-in-messages "3 (#o3, #x3, ?\\C-c)")
913 "g"
914 (should (equal edebug-tests-@-result 5)))))
915
902(provide 'edebug-tests) 916(provide 'edebug-tests)
903;;; edebug-tests.el ends here 917;;; edebug-tests.el ends here