diff options
| author | Hong Xu <hong@topbug.net> | 2016-12-12 17:55:25 -0800 |
|---|---|---|
| committer | Noam Postavsky <npostavs@gmail.com> | 2017-01-26 20:14:19 -0500 |
| commit | 7cb7a582f44db94292709d35f4f5474f891f03b0 (patch) | |
| tree | e0ab66d0b9409565128b65e01061dbd061f48502 /test/lisp/progmodes/python-tests.el | |
| parent | 3485c1693efb709cfc15023d9b38978278731a32 (diff) | |
| download | emacs-7cb7a582f44db94292709d35f4f5474f891f03b0.tar.gz | |
python-mode: Fix detection for opening blocks.
* python.el (python-info-dedenter-opening-block-positions): There
can't be any back-indented lines between an opening block and the
current line.
* python-tests.el (python-indent-electric-colon-4): Add an indent
test case where there is one-more indented previous opening block.
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
| -rw-r--r-- | test/lisp/progmodes/python-tests.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 2df1bbf50d8..158c52f080c 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -1156,6 +1156,27 @@ if do: (python-tests-look-at "that)") (should (= (current-indentation) 6)))) +(ert-deftest python-indent-electric-colon-4 () + "Test indentation case where there is one more-indented previous open block." + (python-tests-with-temp-buffer + " +def f(): + if True: + a = 5 + + if True: + a = 10 + + b = 3 + +else +" + (python-tests-look-at "else") + (goto-char (line-end-position)) + (python-tests-self-insert ":") + (python-tests-look-at "else" -1) + (should (= (current-indentation) 4)))) + (ert-deftest python-indent-region-1 () "Test indentation case from Bug#18843." (let ((contents " |
