summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkobarity <kobarity@gmail.com>2022-08-15 16:30:23 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-08-15 16:30:23 +0200
commit0d3aebec0141ab57362477c50065222a03d57c08 (patch)
tree4d55d885963c668ccb58fa4084ba326e22721574 /test
parent5025b2566e72ba37b62c2a00feef46268fc9f468 (diff)
downloademacs-0d3aebec0141ab57362477c50065222a03d57c08.tar.gz
emacs-0d3aebec0141ab57362477c50065222a03d57c08.tar.bz2
emacs-0d3aebec0141ab57362477c50065222a03d57c08.zip
Fix `python-nav-forward-block' moving backward under certain conditions
* lisp/progmodes/python.el (python-nav-forward-block): Add check for not moving backward (bug#57223).
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/python-tests.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index d303050fad9..9e8fa7f5520 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -2942,6 +2942,22 @@ if request.user.is_authenticated():
(python-tests-look-at
"if request.user.is_authenticated():" -1)))))
+(ert-deftest python-nav-forward-block-2 ()
+ (python-tests-with-temp-buffer
+ "
+if True:
+ pass
+"
+ (python-tests-look-at "if True:")
+ (should (not (save-excursion (python-nav-forward-block))))
+ (should (not (save-excursion (python-nav-forward-block -1))))
+ (forward-char)
+ (should (not (save-excursion (python-nav-forward-block))))
+ (should (= (save-excursion (python-nav-forward-block -1))
+ (progn
+ (end-of-line)
+ (python-tests-look-at "if True:" -1))))))
+
(ert-deftest python-nav-forward-sexp-1 ()
(python-tests-with-temp-buffer
"