aboutsummaryrefslogtreecommitdiffstats
path: root/test/automated/python-tests.el
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2013-12-12 20:32:05 -0300
committerFabián Ezequiel Gallina2013-12-12 20:32:05 -0300
commitbc9222c93463e8aaaf116ed945c3d2007adf771d (patch)
tree7ee2d0bb246dcdf1e1341011b14d8bb2386671d8 /test/automated/python-tests.el
parentb55e11bf851ac73e1041a4a24cca3f81d93039e4 (diff)
downloademacs-bc9222c93463e8aaaf116ed945c3d2007adf771d.tar.gz
emacs-bc9222c93463e8aaaf116ed945c3d2007adf771d.zip
* 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/automated/python-tests.el')
-rw-r--r--test/automated/python-tests.el22
1 files changed, 22 insertions, 0 deletions
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):
458 (should (eq (car (python-indent-context)) 'after-beginning-of-block)) 458 (should (eq (car (python-indent-context)) 'after-beginning-of-block))
459 (should (= (python-indent-calculate-indentation) 12)))) 459 (should (= (python-indent-calculate-indentation) 12))))
460 460
461(ert-deftest python-indent-dedenters-2 ()
462 "Check one-liner block special case.."
463 (python-tests-with-temp-buffer
464 "
465cond = True
466if cond:
467
468 if cond: print 'True'
469else: print 'False'
470
471else:
472 return
473"
474 (python-tests-look-at "else: print 'False'")
475 ;; When a block has code after ":" it's just considered a simple
476 ;; line as that's a common thing to happen in one-liners.
477 (should (eq (car (python-indent-context)) 'after-line))
478 (should (= (python-indent-calculate-indentation) 4))
479 (python-tests-look-at "else:")
480 (should (eq (car (python-indent-context)) 'after-line))
481 (should (= (python-indent-calculate-indentation) 0))))
482
461(ert-deftest python-indent-after-backslash-1 () 483(ert-deftest python-indent-after-backslash-1 ()
462 "The most common case." 484 "The most common case."
463 (python-tests-with-temp-buffer 485 (python-tests-with-temp-buffer