>From 098f49607e19a3246b087afbebb624a3736ef300 Mon Sep 17 00:00:00 2001 From: Marcin Borkowski Date: Mon, 19 Mar 2018 06:17:31 +0100 Subject: [PATCH 2/2] Add a regression test for `beginning-of-defun-comments` --- test/lisp/emacs-lisp/lisp-tests.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/lisp/emacs-lisp/lisp-tests.el b/test/lisp/emacs-lisp/lisp-tests.el index ec197602b6..b456a65737 100644 --- a/test/lisp/emacs-lisp/lisp-tests.el +++ b/test/lisp/emacs-lisp/lisp-tests.el @@ -372,6 +372,26 @@ elisp-tests-with-temp-buffer " "Test buffer for `mark-defun'.")) +(ert-deftest mark-defun-c-mode () + "Test `mark-defun` in C mode." + (setq last-command nil) + (tests-with-temp-buffer c-mode + "int test_func1(int a) +{ + int i; + + return 0; +} +=!beg-of-defun=int test_func2(int a) +{ + int i=!inside-2=; + + return 0; +}" + (goto-char inside-2) + (mark-defun) + (should (= (point) beg-of-defun)))) + (ert-deftest mark-defun-no-arg-region-inactive () "Test `mark-defun' with no prefix argument and inactive region." -- 2.16.2