summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkobarity <kobarity@gmail.com>2022-08-07 16:10:26 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-08-07 16:10:58 +0200
commit11e6c12def5e617fb07d604e82c9bf5289c6e827 (patch)
tree819526971489cc7426cb411136744be45ada52dd /test
parent75929535530d7c5ab48565a33b33b4e84026b368 (diff)
downloademacs-11e6c12def5e617fb07d604e82c9bf5289c6e827.tar.gz
emacs-11e6c12def5e617fb07d604e82c9bf5289c6e827.tar.bz2
emacs-11e6c12def5e617fb07d604e82c9bf5289c6e827.zip
Fix blank/comment line handling in python-nav-beginning-of-block
* lisp/progmodes/python.el (python-nav-beginning-of-block): Fix handling of blank/comment line right after block start (bug#57038).
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/python-tests.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 07f2c4f09a3..eb571226909 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -2734,6 +2734,28 @@ def decoratorFunctionWithArguments(arg1, arg2, arg3):
(point))
(python-tests-look-at "def wwrap(f):" -1)))))
+(ert-deftest python-nav-beginning-of-block-2 ()
+ (python-tests-with-temp-buffer
+ "
+if True:
+
+ pass
+if False:
+ # comment
+ pass
+"
+ (python-tests-look-at "if True:")
+ (forward-line)
+ (should (= (save-excursion
+ (python-nav-beginning-of-block)
+ (point))
+ (python-tests-look-at "if True:" -1)))
+ (python-tests-look-at "# comment")
+ (should (= (save-excursion
+ (python-nav-beginning-of-block)
+ (point))
+ (python-tests-look-at "if False:" -1)))))
+
(ert-deftest python-nav-end-of-block-1 ()
(python-tests-with-temp-buffer
"