diff options
| author | Fabián Ezequiel Gallina | 2013-07-12 22:55:58 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2013-07-12 22:55:58 -0300 |
| commit | 1f0480d4cdea9a266d73f184c56dc94915f1c67a (patch) | |
| tree | 26dd02301a02b83be4996d3aa4c4369256a1ede3 /test/automated/python-tests.el | |
| parent | deee89ff661e2544a3c703d12a3ea81b4ee5b34f (diff) | |
| download | emacs-1f0480d4cdea9a266d73f184c56dc94915f1c67a.tar.gz emacs-1f0480d4cdea9a266d73f184c56dc94915f1c67a.zip | |
* lisp/progmodes/python.el (python-imenu--build-tree): Fix corner case
in nested defuns.
* test/automated/python-tests.el (python-imenu-create-index-2)
(python-imenu-create-index-3): New tests.
Diffstat (limited to 'test/automated/python-tests.el')
| -rw-r--r-- | test/automated/python-tests.el | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index 1dffe9544fe..fdae235ad38 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el | |||
| @@ -1745,6 +1745,53 @@ class Baz(object): | |||
| 1745 | (cons "c (def)" (copy-marker 626))))) | 1745 | (cons "c (def)" (copy-marker 626))))) |
| 1746 | (python-imenu-create-index))))) | 1746 | (python-imenu-create-index))))) |
| 1747 | 1747 | ||
| 1748 | (ert-deftest python-imenu-create-index-2 () | ||
| 1749 | (python-tests-with-temp-buffer | ||
| 1750 | " | ||
| 1751 | class Foo(object): | ||
| 1752 | def foo(self): | ||
| 1753 | def foo1(): | ||
| 1754 | pass | ||
| 1755 | |||
| 1756 | def foobar(self): | ||
| 1757 | pass | ||
| 1758 | " | ||
| 1759 | (goto-char (point-max)) | ||
| 1760 | (should (equal | ||
| 1761 | (list | ||
| 1762 | (list | ||
| 1763 | "Foo (class)" | ||
| 1764 | (cons "*class definition*" (copy-marker 2)) | ||
| 1765 | (list | ||
| 1766 | "foo (def)" | ||
| 1767 | (cons "*function definition*" (copy-marker 21)) | ||
| 1768 | (cons "foo1 (def)" (copy-marker 40))) | ||
| 1769 | (cons "foobar (def)" (copy-marker 78)))) | ||
| 1770 | (python-imenu-create-index))))) | ||
| 1771 | |||
| 1772 | (ert-deftest python-imenu-create-index-3 () | ||
| 1773 | (python-tests-with-temp-buffer | ||
| 1774 | " | ||
| 1775 | class Foo(object): | ||
| 1776 | def foo(self): | ||
| 1777 | def foo1(): | ||
| 1778 | pass | ||
| 1779 | def foo2(): | ||
| 1780 | pass | ||
| 1781 | " | ||
| 1782 | (goto-char (point-max)) | ||
| 1783 | (should (equal | ||
| 1784 | (list | ||
| 1785 | (list | ||
| 1786 | "Foo (class)" | ||
| 1787 | (cons "*class definition*" (copy-marker 2)) | ||
| 1788 | (list | ||
| 1789 | "foo (def)" | ||
| 1790 | (cons "*function definition*" (copy-marker 21)) | ||
| 1791 | (cons "foo1 (def)" (copy-marker 40)) | ||
| 1792 | (cons "foo2 (def)" (copy-marker 77))))) | ||
| 1793 | (python-imenu-create-index))))) | ||
| 1794 | |||
| 1748 | (ert-deftest python-imenu-create-flat-index-1 () | 1795 | (ert-deftest python-imenu-create-flat-index-1 () |
| 1749 | (python-tests-with-temp-buffer | 1796 | (python-tests-with-temp-buffer |
| 1750 | " | 1797 | " |