diff options
author | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2013-12-12 20:32:05 -0300 |
---|---|---|
committer | Fabián Ezequiel Gallina <fgallina@gnu.org> | 2013-12-12 20:32:05 -0300 |
commit | bc9222c93463e8aaaf116ed945c3d2007adf771d (patch) | |
tree | 7ee2d0bb246dcdf1e1341011b14d8bb2386671d8 /test | |
parent | b55e11bf851ac73e1041a4a24cca3f81d93039e4 (diff) | |
download | emacs-bc9222c93463e8aaaf116ed945c3d2007adf771d.tar.gz |
* lisp/progmodes/python.el (python-indent-calculate-indentation): Fix
de-denters cornercase.
* test/automated/python-tests.el (python-indent-dedenters-2): New test.
Fixes: debbugs:15731
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 4 | ||||
-rw-r--r-- | test/automated/python-tests.el | 22 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 9931e81eb43..6f75b33af95 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,5 +1,9 @@ 2013-12-12 Fabián Ezequiel Gallina <fgallina@gnu.org> + * automated/python-tests.el (python-indent-dedenters-2): New test. + +2013-12-12 Fabián Ezequiel Gallina <fgallina@gnu.org> + * automated/python-tests.el (python-indent-after-comment-1) (python-indent-after-comment-2): New tests. diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index 84be598b6dd..5756507fc92 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el @@ -458,6 +458,28 @@ def foo(a, b, c): (should (eq (car (python-indent-context)) 'after-beginning-of-block)) (should (= (python-indent-calculate-indentation) 12)))) +(ert-deftest python-indent-dedenters-2 () + "Check one-liner block special case.." + (python-tests-with-temp-buffer + " +cond = True +if cond: + + if cond: print 'True' +else: print 'False' + +else: + return +" + (python-tests-look-at "else: print 'False'") + ;; When a block has code after ":" it's just considered a simple + ;; line as that's a common thing to happen in one-liners. + (should (eq (car (python-indent-context)) 'after-line)) + (should (= (python-indent-calculate-indentation) 4)) + (python-tests-look-at "else:") + (should (eq (car (python-indent-context)) 'after-line)) + (should (= (python-indent-calculate-indentation) 0)))) + (ert-deftest python-indent-after-backslash-1 () "The most common case." (python-tests-with-temp-buffer |