diff options
| author | Dmitry Lazurkin | 2017-01-04 21:46:21 +0300 |
|---|---|---|
| committer | Noam Postavsky | 2017-01-12 20:40:19 -0500 |
| commit | d4a97088f69eb5729261ee4581cfb7d60c673ebd (patch) | |
| tree | 01aa98aa5b6f31c31e4b66192a34a57868b45730 /test | |
| parent | 55b52658470322a701000e88728d096a03b7c8ca (diff) | |
| download | emacs-d4a97088f69eb5729261ee4581cfb7d60c673ebd.tar.gz emacs-d4a97088f69eb5729261ee4581cfb7d60c673ebd.zip | |
Fix extracting async def type and name in python mode imenu
* lisp/progmodes/python.el (python-imenu--get-defun-type-name):
New function.
(python-imenu--build-tree): Use python-imenu--get-defun-type-name for
extract async or simple def type and name at current
position (Bug#24820).
* test/lisp/progmodes/python-tests.el (python-imenu-create-index-1):
(python-imenu-create-flat-index-1): Add async def's.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/python-tests.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 94c356b589e..2df1bbf50d8 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el | |||
| @@ -3559,6 +3559,9 @@ class Baz(object): | |||
| 3559 | 3559 | ||
| 3560 | def c(self): | 3560 | def c(self): |
| 3561 | pass | 3561 | pass |
| 3562 | |||
| 3563 | async def d(self): | ||
| 3564 | pass | ||
| 3562 | " | 3565 | " |
| 3563 | (goto-char (point-max)) | 3566 | (goto-char (point-max)) |
| 3564 | (should (equal | 3567 | (should (equal |
| @@ -3580,7 +3583,8 @@ class Baz(object): | |||
| 3580 | (list | 3583 | (list |
| 3581 | "Frob (class)" | 3584 | "Frob (class)" |
| 3582 | (cons "*class definition*" (copy-marker 601)) | 3585 | (cons "*class definition*" (copy-marker 601)) |
| 3583 | (cons "c (def)" (copy-marker 626))))) | 3586 | (cons "c (def)" (copy-marker 626)) |
| 3587 | (cons "d (async def)" (copy-marker 665))))) | ||
| 3584 | (python-imenu-create-index))))) | 3588 | (python-imenu-create-index))))) |
| 3585 | 3589 | ||
| 3586 | (ert-deftest python-imenu-create-index-2 () | 3590 | (ert-deftest python-imenu-create-index-2 () |
| @@ -3702,6 +3706,9 @@ class Baz(object): | |||
| 3702 | 3706 | ||
| 3703 | def c(self): | 3707 | def c(self): |
| 3704 | pass | 3708 | pass |
| 3709 | |||
| 3710 | async def d(self): | ||
| 3711 | pass | ||
| 3705 | " | 3712 | " |
| 3706 | (goto-char (point-max)) | 3713 | (goto-char (point-max)) |
| 3707 | (should (equal | 3714 | (should (equal |
| @@ -3714,7 +3721,8 @@ class Baz(object): | |||
| 3714 | (cons "Baz.a" (copy-marker 539)) | 3721 | (cons "Baz.a" (copy-marker 539)) |
| 3715 | (cons "Baz.b" (copy-marker 570)) | 3722 | (cons "Baz.b" (copy-marker 570)) |
| 3716 | (cons "Baz.Frob" (copy-marker 601)) | 3723 | (cons "Baz.Frob" (copy-marker 601)) |
| 3717 | (cons "Baz.Frob.c" (copy-marker 626))) | 3724 | (cons "Baz.Frob.c" (copy-marker 626)) |
| 3725 | (cons "Baz.Frob.d" (copy-marker 665))) | ||
| 3718 | (python-imenu-create-flat-index))))) | 3726 | (python-imenu-create-flat-index))))) |
| 3719 | 3727 | ||
| 3720 | (ert-deftest python-imenu-create-flat-index-2 () | 3728 | (ert-deftest python-imenu-create-flat-index-2 () |