diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-07-27 11:38:19 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-07-27 11:38:19 +0200 |
commit | 8be5481b8ed869e1ac04c07c3919a9a49afd8667 (patch) | |
tree | 2e23c31a5961c0f90668bd924a61b7734e98b091 /test/lisp/progmodes | |
parent | dc84264f3cb2ea9ab5b0af9f3529ebddb6bc0219 (diff) | |
download | emacs-8be5481b8ed869e1ac04c07c3919a9a49afd8667.tar.gz emacs-8be5481b8ed869e1ac04c07c3919a9a49afd8667.tar.bz2 emacs-8be5481b8ed869e1ac04c07c3919a9a49afd8667.zip |
Add a test for python-mode comment/else problem
Based on a patch from kobarity <kobarity@gmail.com>
Diffstat (limited to 'test/lisp/progmodes')
-rw-r--r-- | test/lisp/progmodes/python-tests.el | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 3b10bde23bc..6f2ad87f81a 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -1122,6 +1122,35 @@ if save: (python-indent-line t) (should (= (python-indent-calculate-indentation t) 8)))) +(ert-deftest python-indent-dedenters-comment-else () + "Test de-indentation for the else keyword with comments before it." + (python-tests-with-temp-buffer + " +if save: + try: + write_to_disk(data) + except IOError: + msg = 'Error saving to disk' + message(msg) + logger.exception(msg) + except Exception: + if hide_details: + logger.exception('Unhandled exception') + # comment + else + finally: + data.free() +" + (python-tests-look-at "else\n") + (should (eq (car (python-indent-context)) :at-dedenter-block-start)) + (should (= (python-indent-calculate-indentation) 8)) + (python-indent-line t) + (should (= (python-indent-calculate-indentation t) 4)) + (python-indent-line t) + (should (= (python-indent-calculate-indentation t) 0)) + (python-indent-line t) + (should (= (python-indent-calculate-indentation t) 8)))) + (ert-deftest python-indent-dedenters-3 () "Test de-indentation for the except keyword." (python-tests-with-temp-buffer |