summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkobarity <kobarity@gmail.com>2023-03-10 14:26:22 +0900
committerDmitry Gutov <dgutov@yandex.ru>2023-03-11 15:18:47 +0200
commitc0cf69f7a17b657c784518434e1a049ce6970a43 (patch)
tree762ed7c3862345a08310a65940c199e1aff78f7b /test
parentdb178517ce73618f7a659e355639893748db2e45 (diff)
downloademacs-c0cf69f7a17b657c784518434e1a049ce6970a43.tar.gz
Make "case" keyword a dedenter in Python
* lisp/progmodes/python.el (python-rx): Add "case" to dedenter. (python-info-dedenter-opening-block-positions): Add "case" to pairs. * test/lisp/progmodes/python-tests.el (python-indent-dedenters-9): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/python-tests.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 2568299bb66..e5a9d128bc5 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -1658,6 +1658,21 @@ a == 4):
(python-indent-line t)
(should (= (python-indent-calculate-indentation t) 6))))
+(ert-deftest python-indent-dedenters-9 ()
+ "Test de-indentation for the case keyword."
+ (python-tests-with-temp-buffer
+ "
+match a:
+ case 1:
+ print(1)
+ case 2
+"
+ (python-tests-look-at "case 2")
+ (should (eq (car (python-indent-context)) :at-dedenter-block-start))
+ (should (= (python-indent-calculate-indentation) 4))
+ (python-indent-line t)
+ (should (= (python-indent-calculate-indentation t) 4))))
+
(ert-deftest python-indent-inside-string-1 ()
"Test indentation for strings."
(python-tests-with-temp-buffer